summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.com>2011-11-02 13:24:09 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2011-11-15 15:30:22 +0000
commit6cb2b5d0f9e4a164537e3861f787e603d02bb8e4 (patch)
treee3158acbe066644fbb5f65fc24cf9c61ec37679d
parent31c2cd55912c72c82cba28202f220a80c8b4faca (diff)
add case for "cancel subscription" to test_local_pending
-rw-r--r--tests/twisted/roster/test-google-roster.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py
index b419cd9e8..3773377df 100644
--- a/tests/twisted/roster/test-google-roster.py
+++ b/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,