From d12949ff1cf1a6405d6f430bc8ca77567b7cc9be Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 26 Aug 2011 12:14:57 -0700 Subject: Fix typos in XEP-0060, start of docs and tests. --- tests/test_stream_xep_0060.py | 106 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tests/test_stream_xep_0060.py (limited to 'tests') diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py new file mode 100644 index 00000000..cb93bbf6 --- /dev/null +++ b/tests/test_stream_xep_0060.py @@ -0,0 +1,106 @@ +import sys +import time +import threading + +from sleekxmpp.test import * + + +class TestStreamPubsub(SleekTest): + + """ + Test using the XEP-0030 plugin. + """ + + def setUp(self): + self.stream_start() + + def tearDown(self): + self.stream_close() + + def testCreateInstantNode(self): + """Test creating an instant node""" + t = threading.Thread(name='create_node', + target=self.xmpp['xep_0060'].create_node, + args=('pubsub.example.com', None)) + t.start() + + self.send(""" + + + + + + """) + + self.recv(""" + + + + + + """) + + t.join() + + def testCreateNodeNoConfig(self): + """Test creating a node without a config""" + t = threading.Thread(name='create_node', + target=self.xmpp['xep_0060'].create_node, + args=('pubsub.example.com', 'princely_musings')) + t.start() + + self.send(""" + + + + + + """) + + self.recv(""" + + """) + + t.join() + + def testCreateNodeConfig(self): + """Test creating a node with a config""" + form = self.xmpp['xep_0004'].stanza.Form() + form['type'] = 'submit' + form.add_field(var='pubsub#access_model', value='whitelist') + + t = threading.Thread(name='create_node', + target=self.xmpp['xep_0060'].create_node, + args=('pubsub.example.com', 'princely_musings'), + kwargs={'config': form}) + t.start() + + self.send(""" + + + + + + + whitelist + + + http://jabber.org/protocol/pubsub#node_config + + + + + + """) + + self.recv(""" + + """) + + t.join() + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub) -- cgit v1.2.3