[telepathy-gabble/master] New-school-ify test-roster-subscribe

Will Thompson will.thompson at collabora.co.uk
Wed Jul 15 05:42:51 PDT 2009


---
 tests/twisted/roster/test-roster-subscribe.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/twisted/roster/test-roster-subscribe.py b/tests/twisted/roster/test-roster-subscribe.py
index 3b4400f..1911ea4 100644
--- a/tests/twisted/roster/test-roster-subscribe.py
+++ b/tests/twisted/roster/test-roster-subscribe.py
@@ -7,7 +7,7 @@ import dbus
 
 from twisted.words.xish import domish
 
-from servicetest import EventPattern
+from servicetest import EventPattern, wrap_channel, assertLength, assertEquals
 from gabbletest import acknowledge_iq, exec_test
 import constants as cs
 import ns
@@ -32,16 +32,16 @@ def test(q, bus, conn, stream):
         if chan_name == 'subscribe':
             break
 
+    chan = wrap_channel(bus.get_object(conn.bus_name, path), 'ContactList')
+    assertLength(0, chan.Group.GetMembers())
+
     # request subscription
-    chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
-    assert group_iface.GetMembers() == []
-    handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
-    group_iface.AddMembers([handle], '')
+    handle = conn.RequestHandles(cs.HT_CONTACT, ['bob at foo.com'])[0]
+    chan.Group.AddMembers([handle], '')
 
     event = q.expect('stream-iq', iq_type='set', query_ns=ns.ROSTER)
     item = event.query.firstChildElement()
-    assert item["jid"] == 'bob at foo.com'
+    assertEquals('bob at foo.com', item["jid"])
 
     acknowledge_iq(stream, event.stanza)
 
@@ -54,7 +54,7 @@ def test(q, bus, conn, stream):
 
     q.expect_many(
             EventPattern('dbus-signal', signal='MembersChanged',
-                args=['', [2], [], [], [], 0, 0]),
+                args=['', [handle], [], [], [], 0, 0]),
             EventPattern('stream-presence'),
             )
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list