diff options
author | Nathan Fritz <fritzy@netflint.net> | 2010-01-08 07:01:19 +0000 |
---|---|---|
committer | Nathan Fritz <fritzy@netflint.net> | 2010-01-08 07:01:19 +0000 |
commit | 218c7318e040cd8acb90dfc445b7388a37756d8b (patch) | |
tree | 41aa0dcd3927632e11117357b440ece7f7814252 /tests/test_pubsubstanzas.py | |
parent | 137ef61523d178a12c08da3f544e81a3135f3cf7 (diff) | |
download | slixmpp-218c7318e040cd8acb90dfc445b7388a37756d8b.tar.gz slixmpp-218c7318e040cd8acb90dfc445b7388a37756d8b.tar.bz2 slixmpp-218c7318e040cd8acb90dfc445b7388a37756d8b.tar.xz slixmpp-218c7318e040cd8acb90dfc445b7388a37756d8b.zip |
* added tests
Diffstat (limited to 'tests/test_pubsubstanzas.py')
-rw-r--r-- | tests/test_pubsubstanzas.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_pubsubstanzas.py b/tests/test_pubsubstanzas.py new file mode 100644 index 00000000..37deeca1 --- /dev/null +++ b/tests/test_pubsubstanzas.py @@ -0,0 +1,28 @@ +import unittest + +class testpubsubstanzas(unittest.TestCase): + + def setUp(self): + import sleekxmpp.plugins.stanza_pubsub as ps + self.ps = ps + + def testAffiliations(self): + "Testing iq/pubsub/affiliations/affiliation stanzas" + iq = self.ps.Iq() + aff1 = self.ps.Affiliation() + aff1['node'] = 'testnode' + aff1['affiliation'] = 'owner' + aff2 = self.ps.Affiliation() + aff2['node'] = 'testnode2' + aff2['affiliation'] = 'publisher' + iq['pubsub']['affiliations'].append(aff1) + iq['pubsub']['affiliations'].append(aff2) + xmlstring = """<iq id="0"><pubsub xmlns="http://jabber.org/protocol/pubsub"><affiliations><affiliation node="testnode" affiliation="owner" /><affiliation node="testnode2" affiliation="publisher" /></affiliations></pubsub></iq>""" + iq2 = self.ps.Iq(None, self.ps.ET.fromstring(xmlstring)) + iq3 = self.ps.Iq() + values = iq2.getValues() + iq3.setValues(values) + self.failUnless(xmlstring == str(iq) == str(iq2) == str(iq3)) + + +suite = unittest.TestLoader().loadTestsFromTestCase(testpubsubstanzas) |