diff options
author | Lance Stout <lancestout@gmail.com> | 2011-09-01 15:26:54 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-09-01 15:26:54 -0700 |
commit | 982c2d9b83466d9b2815e534ca821845094af833 (patch) | |
tree | 51b91275f5eb272c7faa5da6847ff0effd8a55a9 /tests/test_stanza_xep_0060.py | |
parent | efa4a9b330dc477bf27d2639c60a879c3e28a00d (diff) | |
download | slixmpp-982c2d9b83466d9b2815e534ca821845094af833.tar.gz slixmpp-982c2d9b83466d9b2815e534ca821845094af833.tar.bz2 slixmpp-982c2d9b83466d9b2815e534ca821845094af833.tar.xz slixmpp-982c2d9b83466d9b2815e534ca821845094af833.zip |
Add tests for pubsub error stanzas
Diffstat (limited to 'tests/test_stanza_xep_0060.py')
-rw-r--r-- | tests/test_stanza_xep_0060.py | 55 |
1 files changed, 55 insertions, 0 deletions
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): </event> </message>""") + 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, """ + <iq type="error"> + <error type="cancel" code="501"> + <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> + <subid-required xmlns="http://jabber.org/protocol/pubsub#errors" /> + </error> + </iq> + """, use_values=False) + + del iq['error']['pubsub']['condition'] + self.check(iq, """ + <iq type="error"> + <error type="cancel" code="501"> + <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> + </error> + </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, """ + <iq type="error"> + <error type="cancel" code="501"> + <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> + <unsupported xmlns="http://jabber.org/protocol/pubsub#errors" feature="instant-node" /> + </error> + </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, """ + <iq type="error"> + <error type="cancel" code="501"> + <feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /> + </error> + </iq> + """, use_values=False) + + suite = unittest.TestLoader().loadTestsFromTestCase(TestPubsubStanzas) |