From 833f95b53af47903d8e4281e8d5668a5addc2383 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 23 Mar 2011 10:00:32 -0400 Subject: Cleaned XEP-0249 plugin, added tests. --- tests/test_stream_xep_0249.py | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/test_stream_xep_0249.py (limited to 'tests') diff --git a/tests/test_stream_xep_0249.py b/tests/test_stream_xep_0249.py new file mode 100644 index 00000000..f49d1f7e --- /dev/null +++ b/tests/test_stream_xep_0249.py @@ -0,0 +1,64 @@ +import sys +import time +import threading + +from sleekxmpp.test import * +from sleekxmpp.xmlstream import ElementBase + + +class TestStreamDirectInvite(SleekTest): + + """ + Test using the XEP-0249 plugin. + """ + + def tearDown(self): + sys.excepthook = sys.__excepthook__ + self.stream_close() + + def testReceiveInvite(self): + self.stream_start(mode='client', + plugins=['xep_0030', + 'xep_0249']) + + events = [] + + def handle_invite(msg): + events.append(True) + + self.xmpp.add_event_handler('groupchat_direct_invite', + handle_invite) + + self.recv(""" + + + + """) + + time.sleep(.5) + + self.failUnless(events == [True], + "Event not raised: %s" % events) + + def testSentDirectInvite(self): + self.stream_start(mode='client', + plugins=['xep_0030', + 'xep_0249']) + + self.xmpp['xep_0249'].send_invitation('user@example.com', + 'sleek@conference.jabber.org', + reason='Need to test Sleek') + + self.send(""" + + + + """) + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamDirectInvite) -- cgit v1.2.3