From e432e30670cc0f86b4c7ec3eb2ca14141056d23d Mon Sep 17 00:00:00 2001 From: Cosimo Alfarano Date: Wed, 2 Nov 2011 13:20:15 +0000 Subject: [PATCH 3/4] expect MembersChanged AND ContactsChanged on sub-request We should explicitly expect the relevant state transition on the publish channel; and when forbidding events, we just forbid them from occurring on the publish channel. (fix by Will Thompson, thanks Will) --- tests/twisted/roster/test-google-roster.py | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py index 3b8d8f6..b419cd9 100644 --- a/tests/twisted/roster/test-google-roster.py +++ b/tests/twisted/roster/test-google-roster.py @@ -282,13 +282,19 @@ def test_local_pending(q, bus, conn, stream, subscribe): presence['type'] = 'subscribe' stream.send(presence) - q.expect('dbus-signal', signal='ContactsChanged', + 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_ASK, '')}, []]) + cs.SUBSCRIPTION_STATE_ASK, '')}, []]), + ) # Now we send the spurious roster update with subscribe="none" and verify - # that nothing happens in reaction to that - change_event = EventPattern('dbus-signal', signal='MembersChanged') + # that nothing happens to her publish state in reaction to that + change_event = EventPattern('dbus-signal', signal='MembersChanged', + predicate=is_publish) q.forbid_events([change_event]) iq = make_set_roster_iq(stream, 'test@localhost/Resource', contact, -- 1.7.7