From 982c2d9b83466d9b2815e534ca821845094af833 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 1 Sep 2011 15:26:54 -0700 Subject: [PATCH] Add tests for pubsub error stanzas --- tests/test_stanza_xep_0060.py | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/test_stanza_xep_0060.py b/tests/test_stanza_xep_0060.py index 34556608..16a7cb37 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)