summaryrefslogtreecommitdiff
path: root/tests/test_stanza_xep_0425.py
diff options
context:
space:
mode:
authorLink Mauve <linkmauve@linkmauve.fr>2020-12-04 20:03:32 +0100
committerLink Mauve <linkmauve@linkmauve.fr>2020-12-04 20:03:32 +0100
commit05749c49690c00f2b1794212b2fb9281b6956a89 (patch)
tree06600402c84040badb8c51a84f683a2ca467ca13 /tests/test_stanza_xep_0425.py
parente592a46c99888594bfb0bf71da99c88755912a37 (diff)
parentc2b09c5c8317d919d7df94b85ac92910de05904a (diff)
downloadslixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.gz
slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.bz2
slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.tar.xz
slixmpp-05749c49690c00f2b1794212b2fb9281b6956a89.zip
Merge branch 'more-xeps' into 'master'
Add a batch of newer XEPs See merge request poezio/slixmpp!69
Diffstat (limited to 'tests/test_stanza_xep_0425.py')
-rw-r--r--tests/test_stanza_xep_0425.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_stanza_xep_0425.py b/tests/test_stanza_xep_0425.py
new file mode 100644
index 00000000..96d979e8
--- /dev/null
+++ b/tests/test_stanza_xep_0425.py
@@ -0,0 +1,47 @@
+import unittest
+from slixmpp import Message, Iq, JID
+from slixmpp.test import SlixTest
+from slixmpp.plugins.xep_0425 import stanza
+
+
+class TestModeration(SlixTest):
+
+ def setUp(self):
+ stanza.register_plugins()
+
+ def testModerate(self):
+ iq = Iq()
+ iq['type'] = 'set'
+ iq['id'] = 'a'
+ iq['apply_to']['id'] = 'some-id'
+ iq['apply_to']['moderate'].enable('retract')
+ iq['apply_to']['moderate']['reason'] = 'R'
+
+ self.check(iq, """
+<iq type='set' id='a'>
+ <apply-to id="some-id" xmlns="urn:xmpp:fasten:0">
+ <moderate xmlns='urn:xmpp:message-moderate:0'>
+ <retract xmlns='urn:xmpp:message-retract:0'/>
+ <reason>R</reason>
+ </moderate>
+ </apply-to>
+</iq>
+ """, use_values=False)
+
+ def testModerated(self):
+ message = Message()
+ message['moderated']['by'] = JID('toto@titi')
+ message['moderated']['retracted']['stamp'] = '2019-09-20T23:09:32Z'
+ message['moderated']['reason'] = 'R'
+
+ self.check(message, """
+<message>
+ <moderated xmlns="urn:xmpp:message-moderate:0" by="toto@titi">
+ <retracted stamp="2019-09-20T23:09:32Z" xmlns="urn:xmpp:message-retract:0" />
+ <reason>R</reason>
+ </moderated>
+</message>
+ """)
+
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestModeration)