From 1e2665df19a866d5676abec566b9d8f190ecdc80 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 12 Feb 2015 12:23:47 +0100 Subject: 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 --- tests/test_stream_exceptions.py | 65 ++--------------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) (limited to 'tests/test_stream_exceptions.py') diff --git a/tests/test_stream_exceptions.py b/tests/test_stream_exceptions.py index 049060e8..f21f197e 100644 --- a/tests/test_stream_exceptions.py +++ b/tests/test_stream_exceptions.py @@ -13,40 +13,11 @@ class TestStreamExceptions(SlixTest): def tearDown(self): self.stream_close() - def testExceptionReply(self): - """Test that raising an exception replies with the original stanza.""" - - def message(msg): - msg.reply() - msg['body'] = 'Body changed' - raise XMPPError(clear=False) - - self.stream_start() - self.xmpp.add_event_handler('message', message) - - self.recv(""" - - This is going to cause an error. - - """) - - self.send(""" - - This is going to cause an error. - - - - - """) - def testExceptionContinueWorking(self): """Test that Slixmpp continues to respond after an XMPPError is raised.""" def message(msg): - msg.reply() - msg['body'] = 'Body changed' - raise XMPPError(clear=False) + raise XMPPError(clear=True) self.stream_start() self.xmpp.add_event_handler('message', message) @@ -59,7 +30,6 @@ class TestStreamExceptions(SlixTest): self.send(""" - This is going to cause an error. @@ -75,7 +45,6 @@ class TestStreamExceptions(SlixTest): self.send(""" - This is going to cause an error. @@ -151,38 +120,8 @@ class TestStreamExceptions(SlixTest): """, use_values=False) - def testThreadedXMPPErrorException(self): - """Test raising an XMPPError exception in a threaded handler.""" - - def message(msg): - raise XMPPError(condition='feature-not-implemented', - text="We don't do things that way here.", - etype='cancel') - - self.stream_start() - self.xmpp.add_event_handler('message', message, - threaded=True) - - self.recv(""" - - This is going to cause an error. - - """) - - self.send(""" - - - - - We don't do things that way here. - - - - """) - def testUnknownException(self): - """Test raising an generic exception in a threaded handler.""" + """Test raising an generic exception in a handler.""" raised_errors = [] -- cgit v1.2.3