diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.com> | 2011-11-02 13:24:09 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-11-15 15:30:22 +0000 |
commit | fdc5afc8372bb64bcbf393d0e5407a0e85e9ee82 (patch) | |
tree | 1b8e12df4cba7fe121bfcb9e1bcb762070fbf91e /gabble | |
parent | 338319d0b57438081beccc1015b79a1e0549512a (diff) |
add case for "cancel subscription" to test_local_pending
Diffstat (limited to 'gabble')
-rw-r--r-- | gabble/tests/twisted/roster/test-google-roster.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gabble/tests/twisted/roster/test-google-roster.py b/gabble/tests/twisted/roster/test-google-roster.py index b419cd9e8..3773377df 100644 --- a/gabble/tests/twisted/roster/test-google-roster.py +++ b/gabble/tests/twisted/roster/test-google-roster.py @@ -305,6 +305,35 @@ def test_local_pending(q, bus, conn, stream, subscribe): sync_dbus(bus, q, conn) q.unforbid_events([change_event]) + # Now we cancel alice's subscription request and verify that if the + # redundant IQ is sent again, it's safely handled + presence = domish.Element(('jabber:client', 'presence')) + presence['from'] = contact + presence['type'] = 'unsubscribe' + stream.send(presence) + + q.expect_many( + EventPattern('dbus-signal', signal='MembersChanged', + args=['', [], [handle], [], [], handle, cs.GC_REASON_NONE], + predicate=is_publish), + EventPattern('dbus-signal', signal='ContactsChanged', + args=[{handle: (cs.SUBSCRIPTION_STATE_NO, + cs.SUBSCRIPTION_STATE_REMOVED_REMOTELY, '')}, []]), + ) + + # Now we send a roster roster update with subscribe="none" again (which + # doesn't change anything, it just confirms what we already knew) and + # verify that nothing happens to her publish state in reaction to that. + q.forbid_events([change_event]) + + iq = make_set_roster_iq(stream, 'test@localhost/Resource', contact, + "none", False) + stream.send(iq) + + sync_stream(q, stream) + sync_dbus(bus, q, conn) + q.unforbid_events([change_event]) + # This event is forbidden in all of the deny tests! remove_events = [ EventPattern('stream-iq', query_ns=ns.ROSTER, |