summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0422.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-12-04 18:45:06 +0100
committermathieui <mathieui@mathieui.net>2020-12-04 19:45:05 +0100
commitfdb0749cd14ea9480687d5e243ec8fc81731e4dd (patch)
tree877fb9817438061c77b92e6a27e3a920a983eea2 /tests/test_stanza_xep_0422.py
parent2c523d1a3b6a97b78b5ee4d688f33fccd71eb83c (diff)
downloadslixmpp-fdb0749cd14ea9480687d5e243ec8fc81731e4dd.tar.gz
slixmpp-fdb0749cd14ea9480687d5e243ec8fc81731e4dd.tar.bz2
slixmpp-fdb0749cd14ea9480687d5e243ec8fc81731e4dd.tar.xz
slixmpp-fdb0749cd14ea9480687d5e243ec8fc81731e4dd.zip
XEP-0422,0424,0425,0439: Add basic stanza tests
Diffstat (limited to 'tests/test_stanza_xep_0422.py')
-rw-r--r--tests/test_stanza_xep_0422.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0422.py b/tests/test_stanza_xep_0422.py
new file mode 100644
index 00000000..9d2cc396
--- /dev/null
+++ b/tests/test_stanza_xep_0422.py
@@ -0,0 +1,33 @@
+import unittest
+from slixmpp import Message
+from slixmpp.test import SlixTest
+from slixmpp.xmlstream import ET
+from slixmpp.plugins.xep_0422 import stanza
+
+
+class TestFastening(SlixTest):
+
+ def setUp(self):
+ stanza.register_plugins()
+
+ def testFastenExternal(self):
+ message = Message()
+ message['apply_to']['id'] = 'some-id'
+ message['apply_to'].xml.append(
+ ET.fromstring('<test xmlns="urn:tmp:test">Test</test>')
+ )
+ message['apply_to']['external']['name'] = 'body'
+ message['body'] = 'Toto'
+
+ self.check(message, """
+<message>
+ <apply-to xmlns="urn:xmpp:fasten:0" id="some-id">
+ <test xmlns="urn:tmp:test">Test</test>
+ <external name='body'/>
+ </apply-to>
+ <body>Toto</body>
+</message>
+ """, use_values=False)
+
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestFastening)