mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 19:19:54 +00:00
Test and fix XEP-0060 delete_node()
This commit is contained in:
parent
2ce617b2ce
commit
13fdab0139
2 changed files with 23 additions and 1 deletions
|
@ -262,7 +262,7 @@ class xep_0060(base_plugin):
|
||||||
callback -- Optional reference to a stream handler function. Will
|
callback -- Optional reference to a stream handler function. Will
|
||||||
be executed when a reply stanza is received.
|
be executed when a reply stanza is received.
|
||||||
"""
|
"""
|
||||||
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='get')
|
iq = self.xmpp.Iq(sto=jid, sfrom=ifrom, stype='set')
|
||||||
iq['pubsub_owner']['delete']['node'] = node
|
iq['pubsub_owner']['delete']['node'] = node
|
||||||
return iq.send(block=block, callback=callback, timeout=timeout)
|
return iq.send(block=block, callback=callback, timeout=timeout)
|
||||||
|
|
||||||
|
|
|
@ -102,5 +102,27 @@ class TestStreamPubsub(SleekTest):
|
||||||
|
|
||||||
t.join()
|
t.join()
|
||||||
|
|
||||||
|
def testDeleteNode(self):
|
||||||
|
"""Test deleting a node"""
|
||||||
|
t = threading.Thread(name='delete_node',
|
||||||
|
target=self.xmpp['xep_0060'].delete_node,
|
||||||
|
args=('pubsub.example.com', 'some_node'))
|
||||||
|
t.start()
|
||||||
|
|
||||||
|
self.send("""
|
||||||
|
<iq type="set" to="pubsub.example.com" id="1">
|
||||||
|
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
|
||||||
|
<delete node="some_node" />
|
||||||
|
</pubsub>
|
||||||
|
</iq>
|
||||||
|
""")
|
||||||
|
|
||||||
|
self.recv("""
|
||||||
|
<iq type="result" id="1"
|
||||||
|
to="tester@localhost" from="pubsub.example.com" />
|
||||||
|
""")
|
||||||
|
|
||||||
|
t.join()
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub)
|
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub)
|
||||||
|
|
Loading…
Reference in a new issue