summaryrefslogtreecommitdiff
path: root/tests/test_stream_xep_0060.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-08-31 23:48:22 -0700
committerLance Stout <lancestout@gmail.com>2011-08-31 23:48:22 -0700
commit76bc0a2ba679828d17871c43bfe076b077c9b600 (patch)
tree87bb181172e726267f7cc20a611473f9fe622fde /tests/test_stream_xep_0060.py
parentd2dc4824ee80cf73575c875dda9a54de4724d4b9 (diff)
downloadslixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.gz
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.bz2
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.tar.xz
slixmpp-76bc0a2ba679828d17871c43bfe076b077c9b600.zip
XEP-0060 v1.13 dictates publishing/retracting one item at a time.
Diffstat (limited to 'tests/test_stream_xep_0060.py')
-rw-r--r--tests/test_stream_xep_0060.py106
1 files changed, 16 insertions, 90 deletions
diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py
index a9099b34..626cea98 100644
--- a/tests/test_stream_xep_0060.py
+++ b/tests/test_stream_xep_0060.py
@@ -359,120 +359,51 @@ class TestStreamPubsub(SleekTest):
</iq>
""")
- def testPublishSingle(self):
- """Test publishing a single item."""
- payload = AtomEntry()
- payload['title'] = 'Test'
-
- register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
-
+ def testPublishNoItems(self):
+ """Test publishing no items (in order to generate events)"""
self.xmpp['xep_0060'].publish(
'pubsub.example.com',
'somenode',
- item_id='ID42',
- payload=payload,
block=False)
self.send("""
<iq type="set" id="1" to="pubsub.example.com">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
- <publish node="somenode">
- <item id="ID42">
- <entry xmlns="http://www.w3.org/2005/Atom">
- <title>Test</title>
- </entry>
- </item>
- </publish>
+ <publish node="somenode" />
</pubsub>
</iq>
""")
- def testPublishSingleOptions(self):
- """Test publishing a single item, with options."""
+ def testPublishSingle(self):
+ """Test publishing a single item."""
payload = AtomEntry()
payload['title'] = 'Test'
register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
- options = self.xmpp['xep_0004'].make_form()
- options.add_field(var='FORM_TYPE', ftype='hidden',
- value='http://jabber.org/protocol/pubsub#publish-options')
- options.add_field(var='pubsub#access_model', ftype='text-single',
- value='presence')
- options['type'] = 'submit'
-
self.xmpp['xep_0060'].publish(
'pubsub.example.com',
'somenode',
- item_id='ID42',
+ id='id42',
payload=payload,
- options=options,
block=False)
self.send("""
<iq type="set" id="1" to="pubsub.example.com">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="somenode">
- <item id="ID42">
+ <item id="id42">
<entry xmlns="http://www.w3.org/2005/Atom">
<title>Test</title>
</entry>
</item>
</publish>
- <publish-options>
- <x xmlns="jabber:x:data" type="submit">
- <field var="FORM_TYPE">
- <value>http://jabber.org/protocol/pubsub#publish-options</value>
- </field>
- <field var="pubsub#access_model">
- <value>presence</value>
- </field>
- </x>
- </publish-options>
- </pubsub>
- </iq>
- """, use_values=False)
-
- def testPublishMulti(self):
- """Test publishing multiple items."""
- payload1 = AtomEntry()
- payload1['title'] = 'Test 1'
-
- payload2 = AtomEntry()
- payload2['title'] = 'Test 2'
-
- register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
-
- self.xmpp['xep_0060'].publish(
- 'pubsub.example.com',
- 'somenode',
- items=[('ID1', payload1),
- ('ID2', payload2)],
- block=False)
- self.send("""
- <iq type="set" id="1" to="pubsub.example.com">
- <pubsub xmlns="http://jabber.org/protocol/pubsub">
- <publish node="somenode">
- <item id="ID1">
- <entry xmlns="http://www.w3.org/2005/Atom">
- <title>Test 1</title>
- </entry>
- </item>
- <item id="ID2">
- <entry xmlns="http://www.w3.org/2005/Atom">
- <title>Test 2</title>
- </entry>
- </item>
- </publish>
</pubsub>
</iq>
- """, use_values=False)
-
- def testPublishMultiOptions(self):
- """Test publishing multiple items, with options."""
- payload1 = AtomEntry()
- payload1['title'] = 'Test 1'
+ """)
- payload2 = AtomEntry()
- payload2['title'] = 'Test 2'
+ def testPublishSingleOptions(self):
+ """Test publishing a single item, with options."""
+ payload = AtomEntry()
+ payload['title'] = 'Test'
register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
@@ -486,22 +417,17 @@ class TestStreamPubsub(SleekTest):
self.xmpp['xep_0060'].publish(
'pubsub.example.com',
'somenode',
- items=[('ID1', payload1),
- ('ID2', payload2)],
+ id='ID42',
+ payload=payload,
options=options,
block=False)
self.send("""
<iq type="set" id="1" to="pubsub.example.com">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="somenode">
- <item id="ID1">
- <entry xmlns="http://www.w3.org/2005/Atom">
- <title>Test 1</title>
- </entry>
- </item>
- <item id="ID2">
+ <item id="ID42">
<entry xmlns="http://www.w3.org/2005/Atom">
- <title>Test 2</title>
+ <title>Test</title>
</entry>
</item>
</publish>