diff options
Diffstat (limited to 'tests/test_stream_exceptions.py')
-rw-r--r-- | tests/test_stream_exceptions.py | 85 |
1 files changed, 12 insertions, 73 deletions
diff --git a/tests/test_stream_exceptions.py b/tests/test_stream_exceptions.py index d18d059a..f21f197e 100644 --- a/tests/test_stream_exceptions.py +++ b/tests/test_stream_exceptions.py @@ -1,11 +1,11 @@ -from sleekxmpp.xmlstream.matcher import MatchXPath -from sleekxmpp.xmlstream.handler import Callback -from sleekxmpp.exceptions import XMPPError +from slixmpp.xmlstream.matcher import MatchXPath +from slixmpp.xmlstream.handler import Callback +from slixmpp.exceptions import XMPPError import unittest -from sleekxmpp.test import SleekTest +from slixmpp.test import SlixTest -class TestStreamExceptions(SleekTest): +class TestStreamExceptions(SlixTest): """ Test handling roster updates. """ @@ -13,40 +13,11 @@ class TestStreamExceptions(SleekTest): 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 Sleek continues to respond after an XMPPError is raised.""" + """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(SleekTest): 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(SleekTest): 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(SleekTest): </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'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 = [] @@ -208,7 +147,7 @@ class TestStreamExceptions(SleekTest): <undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"> - SleekXMPP got into trouble. + Slixmpp got into trouble. </text> </error> </message> @@ -217,7 +156,7 @@ class TestStreamExceptions(SleekTest): self.assertEqual(raised_errors, [True], "Exception was not raised: %s" % raised_errors) def testUnknownException(self): - """Test Sleek continues to respond after an unknown exception.""" + """Test Slixmpp continues to respond after an unknown exception.""" raised_errors = [] @@ -243,7 +182,7 @@ class TestStreamExceptions(SleekTest): <undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"> - SleekXMPP got into trouble. + Slixmpp got into trouble. </text> </error> </message> @@ -261,7 +200,7 @@ class TestStreamExceptions(SleekTest): <undefined-condition xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> <text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"> - SleekXMPP got into trouble. + Slixmpp got into trouble. </text> </error> </message> |