From dcab3de1b4a5293f355f3ef6dd31a1878dfa88be Mon Sep 17 00:00:00 2001 From: Nicoco K Date: Thu, 18 Feb 2021 20:03:22 +0100 Subject: Privileged entities (XEP-0356) --- tests/test_stanza_xep_0356.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/test_stanza_xep_0356.py (limited to 'tests/test_stanza_xep_0356.py') diff --git a/tests/test_stanza_xep_0356.py b/tests/test_stanza_xep_0356.py new file mode 100644 index 00000000..ef116db2 --- /dev/null +++ b/tests/test_stanza_xep_0356.py @@ -0,0 +1,41 @@ +import unittest +from slixmpp import Message +from slixmpp.test import SlixTest +from slixmpp.xmlstream import register_stanza_plugin + +from slixmpp.plugins.xep_0356 import stanza + + +class TestPermissions(SlixTest): + def setUp(self): + stanza.register() + + def testAdvertisePermission(self): + xmlstring = """ + + + + + + + + """ + msg = self.Message() + msg["from"] = "capulet.net" + msg["to"] = "pubub.capulet.lit" + # This raises AttributeError: 'NoneType' object has no attribute 'use_origin_id' + # msg["id"] = "id" + + for access, type_ in [ + ("roster", "both"), + ("message", "outgoing"), + ("presence", "managed_entity"), + ]: + msg["privilege"].add_perm(access, type_) + + self.check(msg, xmlstring) + # Should this one work? → # AttributeError: 'Message' object has no attribute 'permission' + # self.assertEqual(msg.permission["roster"], "both") + + +suite = unittest.TestLoader().loadTestsFromTestCase(TestPermissions) -- cgit v1.2.3