summaryrefslogtreecommitdiff
path: root/tests/test_stream_exceptions.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-06-20 16:27:25 -0700
committerLance Stout <lancestout@gmail.com>2011-06-20 16:27:25 -0700
commit774e0f2022f1ee318dc57c0008ea6cf1ddadce29 (patch)
tree578eb962a707b5a60dfc503449829515bdc0cf54 /tests/test_stream_exceptions.py
parentd1e12cd46fffb56bc7fbe9f1043d01f714356722 (diff)
parentd8d9e8df16c07bd13bbac72e4445a2930407b244 (diff)
downloadslixmpp-774e0f2022f1ee318dc57c0008ea6cf1ddadce29.tar.gz
slixmpp-774e0f2022f1ee318dc57c0008ea6cf1ddadce29.tar.bz2
slixmpp-774e0f2022f1ee318dc57c0008ea6cf1ddadce29.tar.xz
slixmpp-774e0f2022f1ee318dc57c0008ea6cf1ddadce29.zip
Merge branch 'develop' into roster
Diffstat (limited to 'tests/test_stream_exceptions.py')
-rw-r--r--tests/test_stream_exceptions.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_stream_exceptions.py b/tests/test_stream_exceptions.py
index bc01c2a7..1143ce28 100644
--- a/tests/test_stream_exceptions.py
+++ b/tests/test_stream_exceptions.py
@@ -15,6 +15,35 @@ class TestStreamExceptions(SleekTest):
sys.excepthook = sys.__excepthook__
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)
+
+
+ sys.excepthook = lambda *args, **kwargs: None
+ 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 testXMPPErrorException(self):
"""Test raising an XMPPError exception."""