summaryrefslogtreecommitdiff
path: root/tests/pubsub_stanzas.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-01-08 01:45:11 +0000
committerNathan Fritz <fritzy@netflint.net>2010-01-08 01:45:11 +0000
commit8e3168e145da563cc0cca9762ff0c78b65425b73 (patch)
tree9bff7e4f6f798d3c0f5278776c63ae5d20c662fe /tests/pubsub_stanzas.py
parentb54221f2a9f18d90136fda84c08e68eae6ef2a13 (diff)
downloadslixmpp-8e3168e145da563cc0cca9762ff0c78b65425b73.tar.gz
slixmpp-8e3168e145da563cc0cca9762ff0c78b65425b73.tar.bz2
slixmpp-8e3168e145da563cc0cca9762ff0c78b65425b73.tar.xz
slixmpp-8e3168e145da563cc0cca9762ff0c78b65425b73.zip
* added first stanza tests
* added stanza.keys() * stanza.getValues() now return substanzas and plugins * stanza.setValues() now can read substanzas and plugins * stanzas can now be iterable if stanza.subitem is set to a class
Diffstat (limited to 'tests/pubsub_stanzas.py')
-rw-r--r--tests/pubsub_stanzas.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/pubsub_stanzas.py b/tests/pubsub_stanzas.py
new file mode 100644
index 00000000..2fd6df43
--- /dev/null
+++ b/tests/pubsub_stanzas.py
@@ -0,0 +1,23 @@
+from sleekxmpp.plugins.stanza_pubsub import *
+
+def testAffiliations():
+ iq = Iq()
+ aff1 = Affiliation()
+ aff1['node'] = 'testnode'
+ aff1['affiliation'] = 'owner'
+ aff2 = Affiliation()
+ aff2['node'] = 'testnode2'
+ aff2['affiliation'] = 'publisher'
+ iq['pubsub']['affiliations'].append(aff1)
+ iq['pubsub']['affiliations'].append(aff2)
+ print(iq)
+ iq2 = Iq(None, ET.fromstring("""<iq id="0"><pubsub xmlns="http://jabber.org/protocol/pubsub"><affiliations><affiliation node="testnode" affiliation="owner" /><affiliation node="testnode2" affiliation="publisher" /></affiliations></pubsub></iq>"""))
+ iq3 = Iq()
+ values = iq2.getValues()
+ print(values)
+ iq3.setValues(values)
+ print(iq3)
+ print(str(iq) == str(iq2) == str(iq3))
+
+
+testAffiliations()