summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-04-30 08:21:32 -0700
committerNathan Fritz <fritzy@netflint.net>2010-04-30 08:21:32 -0700
commitd40e49397bab4836353cff821359063663dcc2b3 (patch)
tree702e035af6092bb536b9da5a7132d4d69949d1ee
parentc4fa3ab654969a02780cb29508290b1ddd5f1543 (diff)
downloadslixmpp-d40e49397bab4836353cff821359063663dcc2b3.tar.gz
slixmpp-d40e49397bab4836353cff821359063663dcc2b3.tar.bz2
slixmpp-d40e49397bab4836353cff821359063663dcc2b3.tar.xz
slixmpp-d40e49397bab4836353cff821359063663dcc2b3.zip
added collection tests
-rw-r--r--conn_tests/test_pubsubserver.py24
-rw-r--r--conn_tests/testconfig.ini1
2 files changed, 22 insertions, 3 deletions
diff --git a/conn_tests/test_pubsubserver.py b/conn_tests/test_pubsubserver.py
index 9fd3bd8f..a0973cc4 100644
--- a/conn_tests/test_pubsubserver.py
+++ b/conn_tests/test_pubsubserver.py
@@ -109,8 +109,26 @@ class TestPubsubServer(unittest.TestCase):
self.failUnless(self.xmpp2['xep_0060'].unsubscribe(self.pshost, "testnode2"), "Got error response when unsubscribing.")
def test011createcollectionnode(self):
- "Create a collection node"
- self.failUnless(self.xmpp1['xep_0060'].create_node(self.pshost, "testnode3", self.statev['defaultconfig'], True), "Could not create collection node")
+ "Create a collection node w/ Account #2"
+ self.failUnless(self.xmpp2['xep_0060'].create_node(self.pshost, "testnode3", self.statev['defaultconfig'], True), "Could not create collection node")
+
+ def test012subscribecollection(self):
+ "Subscribe Account #1 to collection"
+ self.failUnless(self.xmpp1['xep_0060'].subscribe(self.pshost, "testnode3"))
+
+ def test013assignnodetocollection(self):
+ "Assign node to collection"
+ self.failUnless(self.xmpp2['xep_0060'].addNodeToCollection(self.pshost, 'testnode2', 'testnode3'))
+
+ def test014publishcollection(self):
+ """Publishing item to collection child"""
+ item = ET.Element('{http://netflint.net/protocol/test}test')
+ w = Waiter('wait publish2', StanzaPath('message/pubsub_event/items@node=testnode2'))
+ self.xmpp1.registerHandler(w)
+ result = self.xmpp2['xep_0060'].setItem(self.pshost, "testnode2", (('test2', item),))
+ msg = w.wait(5) # got to get a result in 5 seconds
+ self.failUnless(msg != False, "Account #1 did not get message event: perhaps node was advertised incorrectly?")
+ self.failUnless(result)
def test900cleanup(self):
"Cleaning up"
@@ -168,7 +186,7 @@ if __name__ == '__main__':
TestPubsubServer.xmpp1 = xmpp1
TestPubsubServer.xmpp2 = xmpp2
- TestPubsubServer.pshost = 'pubsub.recon'
+ TestPubsubServer.pshost = config.get('settings', 'pubsub')
xmpp1.waitforstart.get(True)
xmpp2.waitforstart.get(True)
testsuite = unittest.TestLoader().loadTestsFromTestCase(TestPubsubServer)
diff --git a/conn_tests/testconfig.ini b/conn_tests/testconfig.ini
index 91f97a92..fc57bd17 100644
--- a/conn_tests/testconfig.ini
+++ b/conn_tests/testconfig.ini
@@ -1,5 +1,6 @@
[settings]
enabled=true
+pubsub=pubsub.recon
[account1]
jid=fritzy@recon