From ab25301953138343d3d295aaa8872de9c5bc2cf9 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 18 Nov 2010 15:50:45 -0500 Subject: Adding stream tests for XEP-0030. Fixed some errors when responding to disco requests. --- tests/test_stream_xep_0030.py | 83 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 tests/test_stream_xep_0030.py (limited to 'tests/test_stream_xep_0030.py') diff --git a/tests/test_stream_xep_0030.py b/tests/test_stream_xep_0030.py new file mode 100644 index 00000000..5efce788 --- /dev/null +++ b/tests/test_stream_xep_0030.py @@ -0,0 +1,83 @@ +import time +from sleekxmpp.test import * + + +class TestStreamDisco(SleekTest): + """ + Test using the XEP-0030 plugin. + """ + + def tearDown(self): + self.stream_close() + + def testInfoEmptyNode(self): + """ + Info queries to a node MUST have at least one identity + and feature, namely http://jabber.org/protocol/disco#info. + + Since the XEP-0030 plugin is loaded, a disco response should + be generated and not an error result. + """ + self.stream_start(plugins=['xep_0030']) + + self.recv(""" + + + + """) + + self.send(""" + + + + + + """) + + def testInfoEmptyNodeComponent(self): + """ + Test requesting an empty node using a Component. + """ + self.stream_start(mode='component', + plugins=['xep_0030']) + + self.recv(""" + + + + """) + + self.send(""" + + + + + + """) + + def testInfoIncludeNode(self): + """ + Results for info queries directed to a particular node MUST + include the node in the query response. + """ + self.stream_start(plugins=['xep_0030']) + + self.xmpp['xep_0030'].add_node('testing') + + self.recv(""" + + + + """) + + self.send(""" + + + + """, + method='mask') + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamDisco) -- cgit v1.2.3