summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0405.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-11-29 13:37:24 +0100
committermathieui <mathieui@mathieui.net>2020-12-02 19:17:33 +0100
commit15bf6bc827261fa8fa7208da5eb873f5c26f3b6a (patch)
tree715753d7c2b0439af570183e15c96892c5edd1c4 /tests/test_stanza_xep_0405.py
parent3d1615ea54ac71e8d2301507a77265c758e6c047 (diff)
downloadslixmpp-15bf6bc827261fa8fa7208da5eb873f5c26f3b6a.tar.gz
slixmpp-15bf6bc827261fa8fa7208da5eb873f5c26f3b6a.tar.bz2
slixmpp-15bf6bc827261fa8fa7208da5eb873f5c26f3b6a.tar.xz
slixmpp-15bf6bc827261fa8fa7208da5eb873f5c26f3b6a.zip
XEP-0405: add basic stanza tests
Diffstat (limited to 'tests/test_stanza_xep_0405.py')
-rw-r--r--tests/test_stanza_xep_0405.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0405.py b/tests/test_stanza_xep_0405.py
new file mode 100644
index 00000000..5d834cf1
--- /dev/null
+++ b/tests/test_stanza_xep_0405.py
@@ -0,0 +1,55 @@
+import unittest
+from slixmpp import Iq, Message, JID
+from slixmpp.test import SlixTest
+from slixmpp.plugins.xep_0405 import stanza
+from slixmpp.plugins.xep_0369 import stanza as mstanza
+from slixmpp.plugins.xep_0405.mix_pam import BASE_NODES
+
+
+class TestMIXPAMStanza(SlixTest):
+
+ def setUp(self):
+ stanza.register_plugins()
+ mstanza.register_plugins()
+
+ def testMIXPAMJoin(self):
+ """Test that data is converted to base64"""
+ iq = Iq()
+ iq['type'] = 'set'
+ iq['client_join']['channel'] = JID('mix@example.com')
+ for node in BASE_NODES:
+ sub = mstanza.Subscribe()
+ sub['node'] = node
+ iq['client_join']['mix_join'].append(sub)
+ iq['client_join']['mix_join']['nick'] = 'Toto'
+
+ self.check(iq, """
+ <iq type="set">
+ <client-join xmlns='urn:xmpp:mix:pam:2' channel='mix@example.com'>
+ <join xmlns='urn:xmpp:mix:core:1'>
+ <subscribe node='urn:xmpp:mix:nodes:messages'/>
+ <subscribe node='urn:xmpp:mix:nodes:participants'/>
+ <subscribe node='urn:xmpp:mix:nodes:info'/>
+ <nick>Toto</nick>
+ </join>
+ </client-join>
+ </iq>
+ """)
+
+
+ def testMIXPAMLeave(self):
+ iq = Iq()
+ iq['type'] = 'set'
+ iq['client_leave']['channel'] = JID('mix@example.com')
+ iq['client_leave'].enable('mix_leave')
+
+ self.check(iq, """
+ <iq type="set">
+ <client-leave xmlns='urn:xmpp:mix:pam:2' channel='mix@example.com'>
+ <leave xmlns='urn:xmpp:mix:core:1'/>
+ </client-leave>
+ </iq>
+ """)
+
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestMIXPAMStanza)