From 9419f0d88659634c1a3f2dd580e6546e8bfad30a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 23 Sep 2013 16:03:39 +0100 Subject: [PATCH 14/16] roster/remove-from-rp-subscribe.py: convert to Conn.I.ContactList --- tests/twisted/roster/removed-from-rp-subscribe.py | 56 +++++------------------ 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py index d7a5059..4b1a0db 100644 --- a/tests/twisted/roster/removed-from-rp-subscribe.py +++ b/tests/twisted/roster/removed-from-rp-subscribe.py @@ -13,33 +13,6 @@ import ns jid = 'marco@barisione.lit' def test(q, bus, conn, stream, remove, local): - call_async(q, conn.Requests, 'EnsureChannel',{ - cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST, - cs.TARGET_HANDLE_TYPE: cs.HT_LIST, - cs.TARGET_ID: 'subscribe', - }) - e = q.expect('dbus-return', method='EnsureChannel') - subscribe = wrap_channel(bus.get_object(conn.bus_name, e.value[1]), - cs.CHANNEL_TYPE_CONTACT_LIST) - - call_async(q, conn.Requests, 'EnsureChannel',{ - cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST, - cs.TARGET_HANDLE_TYPE: cs.HT_LIST, - cs.TARGET_ID: 'stored', - }) - e = q.expect('dbus-return', method='EnsureChannel') - stored = wrap_channel(bus.get_object(conn.bus_name, e.value[1]), - cs.CHANNEL_TYPE_CONTACT_LIST) - - call_async(q, conn.Requests, 'EnsureChannel',{ - cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST, - cs.TARGET_HANDLE_TYPE: cs.HT_LIST, - cs.TARGET_ID: 'publish', - }) - e = q.expect('dbus-return', method='EnsureChannel') - publish = wrap_channel(bus.get_object(conn.bus_name, e.value[1]), - cs.CHANNEL_TYPE_CONTACT_LIST) - h = conn.get_contact_handle_sync(jid) # Another client logged into our account (Gajim, say) wants to subscribe to @@ -64,12 +37,13 @@ def test(q, bus, conn, stream, remove, local): # In response, Haze adds Marco to the roster, which we guess (wrongly, # in this case) also means subscribe - q.expect_many( - EventPattern('dbus-signal', signal='MembersChanged', - args=['', [h], [], [], [], h, 0], path=subscribe.object_path), - EventPattern('dbus-signal', signal='MembersChanged', - args=['', [h], [], [], [], 0, 0], path=stored.object_path), - ) + q.expect('dbus-signal', signal='ContactsChangedWithID', + args=[{ + h: + (cs.SUBSCRIPTION_STATE_YES, + cs.SUBSCRIPTION_STATE_UNKNOWN, ''), + }, + {h: jid}, {}]) # Gajim sends a to Marco. 'As a result, the # user's server MUST initiate a second roster push to all of the user's @@ -90,8 +64,8 @@ def test(q, bus, conn, stream, remove, local): if remove: # ...removes him from the roster... if local: - # ...by telling Haze to remove him from stored - stored.Group.RemoveMembers([h], '') + # ...by telling Haze to remove him from the roster + conn.ContactList.RemoveContacts([h]) event = q.expect('stream-iq', iq_type='set', query_ns=ns.ROSTER) item = event.query.firstChildElement() @@ -115,15 +89,9 @@ def test(q, bus, conn, stream, remove, local): stream.send(iq) # In response, Haze should announce that Marco has been removed from - # subscribe:remote-pending and stored:members - q.expect_many( - EventPattern('dbus-signal', signal='MembersChanged', - args=['', [], [h], [], [], 0, 0], - path=subscribe.object_path), - EventPattern('dbus-signal', signal='MembersChanged', - args=['', [], [h], [], [], 0, 0], - path=stored.object_path), - ) + # the roster + q.expect('dbus-signal', signal='ContactsChangedWithID', + args=[{}, {}, {h: jid}]) else: # ...rescinds the subscription request... if local: -- 1.8.4.rc3