diff --git a/tests/test_stanza_xep_0060.py b/tests/test_stanza_xep_0060.py index 3455660..16a7cb3 100644 --- a/tests/test_stanza_xep_0060.py +++ b/tests/test_stanza_xep_0060.py @@ -517,4 +517,59 @@ class TestPubsubStanzas(SleekTest): """) + def testPubsubError(self): + """Test getting a pubsub specific condition from an error stanza""" + iq = self.Iq() + iq['error']['type'] = 'cancel' + iq['error']['code'] = '501' + iq['error']['condition'] = 'feature-not-implemented' + iq['error']['pubsub']['condition'] = 'subid-required' + self.check(iq, """ + + + + + + + """, use_values=False) + + del iq['error']['pubsub']['condition'] + self.check(iq, """ + + + + + + """, use_values=False) + + def testPubsubUnsupportedError(self): + """Test getting the feature from an unsupported error""" + iq = self.Iq() + iq['error']['type'] = 'cancel' + iq['error']['code'] = '501' + iq['error']['condition'] = 'feature-not-implemented' + iq['error']['pubsub']['condition'] = 'unsupported' + iq['error']['pubsub']['unsupported'] = 'instant-node' + self.check(iq, """ + + + + + + + """, use_values=False) + + self.assertEqual(iq['error']['pubsub']['condition'], 'unsupported') + self.assertEqual(iq['error']['pubsub']['unsupported'], 'instant-node') + + del iq['error']['pubsub']['unsupported'] + self.check(iq, """ + + + + + + """, use_values=False) + + suite = unittest.TestLoader().loadTestsFromTestCase(TestPubsubStanzas)