diff --git a/tests/test_stanza_element.py b/tests/test_stanza_element.py index f7ec59c0..60ccb7c9 100644 --- a/tests/test_stanza_element.py +++ b/tests/test_stanza_element.py @@ -742,5 +742,37 @@ class TestElementBase(SleekTest): """) + def testBoolInterfaces(self): + """Test using boolean interfaces.""" + + class TestStanza(ElementBase): + name = "foo" + namespace = "foo" + interfaces = set(['bar']) + bool_interfaces = interfaces + + stanza = TestStanza() + self.check(stanza, """ + + """) + + self.assertFalse(stanza['bar'], + "Returned True for missing bool interface element.") + + stanza['bar'] = True + self.check(stanza, """ + + + + """) + + self.assertTrue(stanza['bar'], + "Returned False for present bool interface element.") + + stanza['bar'] = False + self.check(stanza, """ + + """) + suite = unittest.TestLoader().loadTestsFromTestCase(TestElementBase)