diff options
author | Lance Stout <lancestout@gmail.com> | 2010-11-17 15:45:16 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-11-17 15:45:16 -0500 |
commit | ea48bb5ac58aa186c18c42c83e21a6a636bd22a9 (patch) | |
tree | d04eb4d423b9ec9c35e5636a649a0dccdd2ca862 /tests | |
parent | 6ee8a2980c2a7c9a8c65453b1d2c551717069ce5 (diff) | |
download | slixmpp-ea48bb5ac58aa186c18c42c83e21a6a636bd22a9.tar.gz slixmpp-ea48bb5ac58aa186c18c42c83e21a6a636bd22a9.tar.bz2 slixmpp-ea48bb5ac58aa186c18c42c83e21a6a636bd22a9.tar.xz slixmpp-ea48bb5ac58aa186c18c42c83e21a6a636bd22a9.zip |
Fixed some live stream test errors.
Added test demonstrating using multiple stream clients
in a single test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/live_multiple_streams.py | 57 | ||||
-rw-r--r-- | tests/live_test.py | 1 |
2 files changed, 57 insertions, 1 deletions
diff --git a/tests/live_multiple_streams.py b/tests/live_multiple_streams.py new file mode 100644 index 00000000..69ee74c4 --- /dev/null +++ b/tests/live_multiple_streams.py @@ -0,0 +1,57 @@ +import logging + +from sleekxmpp.test import * + + +class TestMultipleStreams(SleekTest): + """ + Test that we can test a live stanza stream. + """ + + def setUp(self): + self.client1 = SleekTest() + self.client2 = SleekTest() + + def tearDown(self): + self.client1.stream_close() + self.client2.stream_close() + + def testMultipleStreams(self): + """Test that we can interact with multiple live ClientXMPP instance.""" + + client1 = self.client1 + client2 = self.client2 + + client1.stream_start(mode='client', + socket='live', + skip=True, + jid='user@localhost/test1', + password='user') + client2.stream_start(mode='client', + socket='live', + skip=True, + jid='user@localhost/test2', + password='user') + + client1.xmpp.send_message(mto='user@localhost/test2', + mbody='test') + + client1.send('message@body=test', method='stanzapath') + client2.recv('message@body=test', method='stanzapath') + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestMultipleStreams) + +if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG, + format='%(levelname)-8s %(message)s') + + tests = unittest.TestSuite([suite]) + result = unittest.TextTestRunner(verbosity=2).run(tests) + test_ns = 'http://andyet.net/protocol/tests' + print("<tests xmlns='%s' %s %s %s %s />" % ( + test_ns, + 'ran="%s"' % result.testsRun, + 'errors="%s"' % len(result.errors), + 'fails="%s"' % len(result.failures), + 'success="%s"' % result.wasSuccessful())) diff --git a/tests/live_test.py b/tests/live_test.py index 16b6f1cc..b71930af 100644 --- a/tests/live_test.py +++ b/tests/live_test.py @@ -1,7 +1,6 @@ import logging from sleekxmpp.test import * -import sleekxmpp.plugins.xep_0033 as xep_0033 class TestLiveStream(SleekTest): |