Add test for purging a pubsub node.

This commit is contained in:
Lance Stout 2011-08-31 21:09:25 -07:00
parent b68785e19e
commit 3f9ca0366b
2 changed files with 21 additions and 2 deletions

View file

@ -72,7 +72,7 @@ registerStanzaPlugin(OwnerConfigure, xep_0004.Form)
class OwnerDefault(OwnerConfigure): class OwnerDefault(OwnerConfigure):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
interfaces = set(('node', 'config')) interfaces = set(('node',))
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}
@ -93,6 +93,7 @@ registerStanzaPlugin(PubsubOwner, OwnerDelete)
class OwnerPurge(ElementBase, OptionalSetting): class OwnerPurge(ElementBase, OptionalSetting):
namespace = 'http://jabber.org/protocol/pubsub#owner' namespace = 'http://jabber.org/protocol/pubsub#owner'
name = 'purge' name = 'purge'
interfaces = set(('node',))
plugin_attrib = name plugin_attrib = name
plugin_attrib_map = {} plugin_attrib_map = {}
plugin_tag_map = {} plugin_tag_map = {}

View file

@ -599,7 +599,25 @@ class TestStreamPubsub(SleekTest):
def testPurge(self): def testPurge(self):
"""Test removing all items from a node.""" """Test removing all items from a node."""
pass t = threading.Thread(name='purge',
target=self.xmpp['xep_0060'].purge,
args=('pubsub.example.com', 'somenode'))
t.start()
self.send("""
<iq type="set" id="1" to="pubsub.example.com">
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
<purge node="somenode" />
</pubsub>
</iq>
""", use_values=False)
self.recv("""
<iq type="result" id="1"
to="tester@localhost" from="pubsub.example.com" />
""")
t.join()
def testGetItem(self): def testGetItem(self):
"""Test retrieving a single item.""" """Test retrieving a single item."""