summaryrefslogtreecommitdiff
path: root/tests/test_stream_exceptions.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-12 12:23:47 +0100
committermathieui <mathieui@mathieui.net>2015-02-12 12:23:47 +0100
commit1e2665df19a866d5676abec566b9d8f190ecdc80 (patch)
tree9fe2f0c501d376291f3d9efc3e9550b34afbf6c7 /tests/test_stream_exceptions.py
parent4d063e287e1bb2010d115325a3c8c6ca7c542bfc (diff)
downloadslixmpp-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_exceptions.py')
-rw-r--r--tests/test_stream_exceptions.py65
1 files changed, 2 insertions, 63 deletions
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("""
- <message>
- <body>This is going to cause an error.</body>
- </message>
- """)
-
- self.send("""
- <message type="error">
- <body>This is going to cause an error.</body>
- <error type="cancel" code="500">
- <undefined-condition
- xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
- </error>
- </message>
- """)
-
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("""
<message type="error">
- <body>This is going to cause an error.</body>
<error type="cancel" code="500">
<undefined-condition
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
@@ -75,7 +45,6 @@ class TestStreamExceptions(SlixTest):
self.send("""
<message type="error">
- <body>This is going to cause an error.</body>
<error type="cancel" code="500">
<undefined-condition
xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
@@ -151,38 +120,8 @@ class TestStreamExceptions(SlixTest):
</iq>
""", 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("""
- <message>
- <body>This is going to cause an error.</body>
- </message>
- """)
-
- self.send("""
- <message type="error">
- <error type="cancel" code="501">
- <feature-not-implemented
- xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
- <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">
- We don&apos;t do things that way here.
- </text>
- </error>
- </message>
- """)
-
def testUnknownException(self):
- """Test raising an generic exception in a threaded handler."""
+ """Test raising an generic exception in a handler."""
raised_errors = []