telepathy-haze: roster/remove-from-rp-subscribe.py: convert to Conn.I. ContactList

Simon McVittie smcv at kemper.freedesktop.org
Tue Sep 24 04:14:09 PDT 2013


Module: telepathy-haze
Branch: master
Commit: b4af6fba89fe7b9a45c19ad6caae7244a3891a34
URL:    http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=b4af6fba89fe7b9a45c19ad6caae7244a3891a34

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Sep 23 16:03:39 2013 +0100

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 at collabora.co.uk>

---

 tests/twisted/roster/removed-from-rp-subscribe.py |   56 +++++----------------
 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 at 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:



More information about the telepathy-commits mailing list