diff options
author | Lance Stout <lancestout@gmail.com> | 2011-06-20 16:27:55 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-06-20 16:27:55 -0700 |
commit | fa716457a5cc8abf207e1da903202398dfb26878 (patch) | |
tree | cb10108eb4d19c30387fc22c5d53a96e3f80431f /tests/test_stream_exceptions.py | |
parent | 4efd41f1ba679348487e1e88b7426830e92a9f9b (diff) | |
parent | d8d9e8df16c07bd13bbac72e4445a2930407b244 (diff) | |
download | slixmpp-fa716457a5cc8abf207e1da903202398dfb26878.tar.gz slixmpp-fa716457a5cc8abf207e1da903202398dfb26878.tar.bz2 slixmpp-fa716457a5cc8abf207e1da903202398dfb26878.tar.xz slixmpp-fa716457a5cc8abf207e1da903202398dfb26878.zip |
Merge branch 'develop' into stream_features
Diffstat (limited to 'tests/test_stream_exceptions.py')
-rw-r--r-- | tests/test_stream_exceptions.py | 29 |
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.""" |