mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-30 11:09:56 +00:00
Test publishing a single item.
This commit is contained in:
parent
3623a7a16a
commit
09252baa71
2 changed files with 37 additions and 3 deletions
|
@ -92,7 +92,8 @@ class Item(ElementBase):
|
|||
plugin_tag_map = {}
|
||||
|
||||
def setPayload(self, value):
|
||||
self.xml.append(value)
|
||||
del self['payload']
|
||||
self.append(value)
|
||||
|
||||
def getPayload(self):
|
||||
childs = self.xml.getchildren()
|
||||
|
|
|
@ -3,6 +3,8 @@ import time
|
|||
import threading
|
||||
|
||||
from sleekxmpp.test import *
|
||||
from sleekxmpp.stanza.atom import AtomEntry
|
||||
from sleekxmpp.xmlstream import register_stanza_plugin
|
||||
|
||||
|
||||
class TestStreamPubsub(SleekTest):
|
||||
|
@ -381,12 +383,43 @@ class TestStreamPubsub(SleekTest):
|
|||
|
||||
def testPublishSingle(self):
|
||||
"""Test publishing a single item."""
|
||||
pass
|
||||
payload = AtomEntry()
|
||||
payload['title'] = 'Test'
|
||||
|
||||
register_stanza_plugin(self.xmpp['xep_0060'].stanza.Item, AtomEntry)
|
||||
|
||||
t = threading.Thread(name='publish_single',
|
||||
target=self.xmpp['xep_0060'].publish,
|
||||
args=('pubsub.example.com', 'somenode'),
|
||||
kwargs={'item_id': 'ID42',
|
||||
'payload': payload})
|
||||
t.start()
|
||||
|
||||
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>
|
||||
</pubsub>
|
||||
</iq>
|
||||
""")
|
||||
|
||||
self.recv("""
|
||||
<iq type="result" id="1"
|
||||
to="tester@localhost" from="pubsub.example.com" />
|
||||
""")
|
||||
|
||||
t.join()
|
||||
|
||||
|
||||
def testPublishSingleOptions(self):
|
||||
"""Test publishing a single item, with options."""
|
||||
|
||||
|
||||
def testPublishMulti(self):
|
||||
"""Test publishing multiple items."""
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue