From 3623a7a16ab36bfc5f0a9c8e74dd38d9c94b4246 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 31 Aug 2011 14:05:29 -0700 Subject: More pubsub unit tests! --- tests/test_stream_xep_0060.py | 108 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 4 deletions(-) (limited to 'tests/test_stream_xep_0060.py') diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py index 15ed06ce..e128eff5 100644 --- a/tests/test_stream_xep_0060.py +++ b/tests/test_stream_xep_0060.py @@ -292,14 +292,36 @@ class TestStreamPubsub(SleekTest): self.recv(""" + to="tester@localhost" from="pubsub.example.com" /> """) t.join() def testGetDefaultNodeConfig(self): - """Tes t retrieving the default config for a given node.""" + """Test retrieving the default node config for a pubsub service.""" t = threading.Thread(name='default_config', + target=self.xmpp['xep_0060'].get_node_config, + args=('pubsub.example.com', None)) + t.start() + + self.send(""" + + + + + + """, use_values=False) + + self.recv(""" + + """) + + t.join() + + def testGetNodeConfig(self): + """Test getting the config for a given node.""" + t = threading.Thread(name='node_config', target=self.xmpp['xep_0060'].get_node_config, args=('pubsub.example.com', 'somenode')) t.start() @@ -307,17 +329,95 @@ class TestStreamPubsub(SleekTest): self.send(""" - + """, use_values=False) self.recv(""" + to="tester@localhost" from="pubsub.example.com" /> + """) + + t.join() + + def testSetNodeConfig(self): + """Test setting the configuration for a node.""" + form = self.xmpp['xep_0004'].make_form() + form.add_field(var='FORM_TYPE', ftype='hidden', + value='http://jabber.org/protocol/pubsub#node_config') + form.add_field(var='pubsub#title', ftype='text-single', + value='This is awesome!') + form['type'] = 'submit' + + t = threading.Thread(name='set_config', + target=self.xmpp['xep_0060'].set_node_config, + args=('pubsub.example.com', 'somenode', form)) + t.start() + + self.send(""" + + + + + + http://jabber.org/protocol/pubsub#node_config + + + This is awesome! + + + + + + """) + + self.recv(""" + """) t.join() + def testPublishSingle(self): + """Test publishing a single item.""" + pass + + def testPublishSingleOptions(self): + """Test publishing a single item, with options.""" + + + def testPublishMulti(self): + """Test publishing multiple items.""" + pass + + def testPublishMultiOptions(self): + """Test publishing multiple items, with options.""" + pass + + def testRetract(self): + """Test deleting an item.""" + pass + + def testPurge(self): + """Test removing all items from a node.""" + pass + + def testGetItem(self): + """Test retrieving a single item.""" + pass + + def testGetLatestItems(self): + """Test retrieving the most recent N items.""" + pass + + def testGetAllItems(self): + """Test retrieving all items.""" + pass + + def testGetSpecificItems(self): + """Test retrieving a specific set of items.""" + pass + suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub) -- cgit v1.2.3