From 28123083f7077c990efaf8807fc88246274880b3 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 24 May 2020 15:00:20 +0200 Subject: Add stanza tests for 0377 --- tests/test_stanza_xep_0377.py | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/test_stanza_xep_0377.py (limited to 'tests') diff --git a/tests/test_stanza_xep_0377.py b/tests/test_stanza_xep_0377.py new file mode 100644 index 00000000..321a26a8 --- /dev/null +++ b/tests/test_stanza_xep_0377.py @@ -0,0 +1,56 @@ +import unittest +from slixmpp import Iq +from slixmpp.test import SlixTest +import slixmpp.plugins.xep_0191 as xep_0191 +import slixmpp.plugins.xep_0377 as xep_0377 +from slixmpp.xmlstream import register_stanza_plugin + + +class TestSpamReporting(SlixTest): + + def setUp(self): + register_stanza_plugin(Iq, xep_0191.Block) + register_stanza_plugin( + xep_0191.Block, + xep_0377.Report, + ) + register_stanza_plugin( + xep_0377.Report, + xep_0377.Text, + ) + + def testCreateReport(self): + report = """ + + + + + + + + """ + + iq = self.Iq() + iq['type'] = 'set' + iq['block']['report']['spam'] = True + + self.check(iq, report) + + def testEnforceOnlyOneSubElement(self): + report = """ + + + + + + + + """ + + iq = self.Iq() + iq['type'] = 'set' + iq['block']['report']['spam'] = True + iq['block']['report']['abuse'] = True + self.check(iq, report) + +suite = unittest.TestLoader().loadTestsFromTestCase(TestSpamReporting) -- cgit v1.2.3