diff options
author | Lance Stout <lancestout@gmail.com> | 2011-09-01 12:08:35 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-09-01 12:09:24 -0700 |
commit | 462b375c8f9ff22cdd4fe282dd90b0a5154a938c (patch) | |
tree | f170742bb85d419f9793cd17c13d4883ea700d17 /tests | |
parent | afbd506cfc5aea6e70edc5cb6584e9d36f539965 (diff) | |
download | slixmpp-462b375c8f9ff22cdd4fe282dd90b0a5154a938c.tar.gz slixmpp-462b375c8f9ff22cdd4fe282dd90b0a5154a938c.tar.bz2 slixmpp-462b375c8f9ff22cdd4fe282dd90b0a5154a938c.tar.xz slixmpp-462b375c8f9ff22cdd4fe282dd90b0a5154a938c.zip |
Owners can modify subscriptions/affiliations. With tests.
94% coverage for the main pubsub plugin! (91% including stanzas)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_stream_xep_0060.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/test_stream_xep_0060.py b/tests/test_stream_xep_0060.py index b90359f9..7839d991 100644 --- a/tests/test_stream_xep_0060.py +++ b/tests/test_stream_xep_0060.py @@ -693,5 +693,57 @@ class TestStreamPubsub(SleekTest): </iq> """) + def testGetNodeAffiliations(self): + """Test getting the affiliations for a node.""" + self.xmpp['xep_0060'].get_node_affiliations( + 'pubsub.example.com', + 'somenode', + block=False) + self.send(""" + <iq type="get" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> + <affiliations node="somenode" /> + </pubsub> + </iq> + """) + + def testModifySubscriptions(self): + """Test owner modifying node subscriptions.""" + self.xmpp['xep_0060'].modify_subscriptions( + 'pubsub.example.com', + 'somenode', + subscriptions=[('user@example.com', 'subscribed'), + ('foo@example.net', 'none')], + block=False) + self.send(""" + <iq type="set" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> + <subscriptions node="somenode"> + <subscription jid="user@example.com" subscription="subscribed" /> + <subscription jid="foo@example.net" subscription="none" /> + </subscriptions> + </pubsub> + </iq> + """) + + def testModifyAffiliations(self): + """Test owner modifying node affiliations.""" + self.xmpp['xep_0060'].modify_affiliations( + 'pubsub.example.com', + 'somenode', + affiliations=[('user@example.com', 'publisher'), + ('foo@example.net', 'none')], + block=False) + self.send(""" + <iq type="set" id="1" to="pubsub.example.com"> + <pubsub xmlns="http://jabber.org/protocol/pubsub#owner"> + <affiliations node="somenode"> + <affiliation jid="user@example.com" affiliation="publisher" /> + <affiliation jid="foo@example.net" affiliation="none" /> + </affiliations> + </pubsub> + </iq> + """) + suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamPubsub) |