XEP-0223: fix node standalone configuration (fixes #3555)
also add a stream test for that
This commit is contained in:
parent
1f14fb54c2
commit
8a127f61d0
@ -48,8 +48,12 @@ class XEP_0223(BasePlugin):
|
||||
|
||||
:param node: Node to set the configuration at.
|
||||
"""
|
||||
config = self.xmpp['xep_0004'].Form()
|
||||
config = self.xmpp['xep_0004'].stanza.Form()
|
||||
config['type'] = 'submit'
|
||||
config.add_field(
|
||||
var='FORM_TYPE',
|
||||
ftype='hidden',
|
||||
value='http://jabber.org/protocol/pubsub#node_config')
|
||||
|
||||
for field, value in self.profile.items():
|
||||
config.add_field(var=field, value=value)
|
||||
|
28
tests/test_stream_xep_0223.py
Normal file
28
tests/test_stream_xep_0223.py
Normal file
@ -0,0 +1,28 @@
|
||||
import unittest
|
||||
from slixmpp.test import SlixTest
|
||||
|
||||
|
||||
class TestPrivatePEP(SlixTest):
|
||||
|
||||
def testConfigureNode(self):
|
||||
self.stream_start(mode='client', plugins=['xep_0223'])
|
||||
|
||||
self.xmpp.plugin['xep_0223'].configure(node="toto")
|
||||
self.send("""
|
||||
<iq type="set" id="1">
|
||||
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
|
||||
<configure node='toto'>
|
||||
<x xmlns='jabber:x:data' type='submit'>
|
||||
<field var='FORM_TYPE' type='hidden'>
|
||||
<value>http://jabber.org/protocol/pubsub#node_config</value>
|
||||
</field>
|
||||
<field var='pubsub#persist_items'><value>1</value></field>
|
||||
<field var='pubsub#access_model'><value>whitelist</value></field>
|
||||
</x>
|
||||
</configure>
|
||||
</pubsub>
|
||||
</iq>
|
||||
""")
|
||||
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestPrivatePEP)
|
Loading…
x
Reference in New Issue
Block a user