summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-23 16:03:39 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-24 12:13:10 +0100
commitb4af6fba89fe7b9a45c19ad6caae7244a3891a34 (patch)
treea05e6a225a421b375bdab9884a28b9321cc01cd8
parent27cfca065ceed41709842ee7c7e366d91b2fb141 (diff)
downloadtelepathy-haze-b4af6fba89fe7b9a45c19ad6caae7244a3891a34.tar.gz
roster/remove-from-rp-subscribe.py: convert to Conn.I.ContactList
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49389 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--tests/twisted/roster/removed-from-rp-subscribe.py56
1 files 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 <presence type='subscribe'/> 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: