diff options
author | mathieui <mathieui@mathieui.net> | 2015-02-12 12:23:47 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-02-12 12:23:47 +0100 |
commit | 1e2665df19a866d5676abec566b9d8f190ecdc80 (patch) | |
tree | 9fe2f0c501d376291f3d9efc3e9550b34afbf6c7 /tests/test_stream_xep_0323.py | |
parent | 4d063e287e1bb2010d115325a3c8c6ca7c542bfc (diff) | |
download | slixmpp-1e2665df19a866d5676abec566b9d8f190ecdc80.tar.gz slixmpp-1e2665df19a866d5676abec566b9d8f190ecdc80.tar.bz2 slixmpp-1e2665df19a866d5676abec566b9d8f190ecdc80.tar.xz slixmpp-1e2665df19a866d5676abec566b9d8f190ecdc80.zip |
Update the test suite.
- monkey-patch our own monkey-patched idle_call to run events immediatly
rather than adding them to the event queue, and add a fake transport
with a fake socket.
- remove the test file related to xep_0059 as it relies on blocking
behavior, and comment out one xep_0030 test uses xep_0059
- remove many instances of threading and sleep()s because they do
nothing except waste time and introduce race conditions.
- keep exactly two sleep() in IoT xeps because they rely on timeouts
Diffstat (limited to 'tests/test_stream_xep_0323.py')
-rw-r--r-- | tests/test_stream_xep_0323.py | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/tests/test_stream_xep_0323.py b/tests/test_stream_xep_0323.py index d8e3b01f..1a25ec2a 100644 --- a/tests/test_stream_xep_0323.py +++ b/tests/test_stream_xep_0323.py @@ -455,8 +455,6 @@ class TestStreamSensorData(SlixTest): </iq> """) - time.sleep(.1) - self.failUnless(results == ["rejected"], "Rejected callback was not properly executed"); @@ -494,8 +492,6 @@ class TestStreamSensorData(SlixTest): </iq> """) - time.sleep(.1) - self.failUnless(results == ["accepted"], "Accepted callback was not properly executed"); @@ -517,13 +513,10 @@ class TestStreamSensorData(SlixTest): for f in fields: callback_data["field_" + f['name']] = f; - t1= threading.Thread(name="request_data", - target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], - "callback": my_callback}); - t1.start(); + self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", + to_jid="you@google.com", + nodeIds=['Device33'], + callback=my_callback) #self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback); self.send(""" @@ -567,9 +560,6 @@ class TestStreamSensorData(SlixTest): </message> """) - t1.join(); - time.sleep(.5) - self.failUnlessEqual(results, ["accepted","fields","done"]); # self.assertIn("nodeId", callback_data); self.assertTrue("nodeId" in callback_data) @@ -651,13 +641,10 @@ class TestStreamSensorData(SlixTest): callback_data["timestamp"] = timestamp; callback_data["error_msg"] = error_msg; - t1= threading.Thread(name="request_data", - target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], - "callback": my_callback}); - t1.start(); + self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", + to_jid="you@google.com", + nodeIds=['Device33'], + callback=my_callback) self.send(""" <iq type='get' @@ -688,9 +675,6 @@ class TestStreamSensorData(SlixTest): </message> """) - t1.join(); - time.sleep(.5) - self.failUnlessEqual(results, ["accepted","failure"]); # self.assertIn("nodeId", callback_data); self.assertTrue("nodeId" in callback_data); @@ -737,7 +721,7 @@ class TestStreamSensorData(SlixTest): </iq> """) - time.sleep(2) + time.sleep(1) self.send(""" <message from='device@clayster.com' @@ -1033,13 +1017,10 @@ class TestStreamSensorData(SlixTest): for f in fields: callback_data["field_" + f['name']] = f; - t1= threading.Thread(name="request_data", - target=self.xmpp['xep_0323'].request_data, - kwargs={"from_jid": "tester@localhost", - "to_jid": "you@google.com", - "nodeIds": ['Device33'], - "callback": my_callback}); - t1.start(); + self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", + to_jid="you@google.com", + nodeIds=['Device33'], + callback=my_callback) #self.xmpp['xep_0323'].request_data(from_jid="tester@localhost", to_jid="you@google.com", nodeIds=['Device33'], callback=my_callback); self.send(""" @@ -1090,9 +1071,6 @@ class TestStreamSensorData(SlixTest): </message> """) - t1.join(); - time.sleep(.5) - self.failUnlessEqual(results, ["queued","started","fields","done"]); # self.assertIn("nodeId", callback_data); self.assertTrue("nodeId" in callback_data); @@ -1161,8 +1139,6 @@ class TestStreamSensorData(SlixTest): </iq> """) - time.sleep(.5) - self.failUnlessEqual(results, ["accepted","cancelled"]); def testDelayedRequestCancel(self): @@ -1239,8 +1215,6 @@ class TestStreamSensorData(SlixTest): </iq> """) - time.sleep(2) - # Ensure we don't get anything after cancellation self.send(None) |