telepathy-haze: Use get_contact_handle_sync, get_contact_handles_sync

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


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Sep 23 13:02:31 2013 +0100

Use get_contact_handle_sync, get_contact_handles_sync

Telepathy 1.0 won't have RequestHandles.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=49389
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 tests/twisted/presence/presence.py                |    2 +-
 tests/twisted/roster/groups.py                    |    2 +-
 tests/twisted/roster/publish.py                   |    5 ++---
 tests/twisted/roster/removed-from-rp-subscribe.py |    2 +-
 tests/twisted/simple-caps.py                      |    4 ++--
 tests/twisted/text/destroy.py                     |    5 +----
 tests/twisted/text/ensure.py                      |    5 +----
 tests/twisted/text/initiate-requestotron.py       |    5 +----
 tests/twisted/text/initiate.py                    |    5 +----
 tests/twisted/text/respawn.py                     |    5 +----
 10 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/tests/twisted/presence/presence.py b/tests/twisted/presence/presence.py
index e35616e..c91ddfd 100644
--- a/tests/twisted/presence/presence.py
+++ b/tests/twisted/presence/presence.py
@@ -12,7 +12,7 @@ from hazetest import exec_test
 import constants as cs
 
 def test(q, bus, conn, stream):
-    amy_handle = conn.RequestHandles(1, ['amy at foo.com'])[0]
+    amy_handle = conn.get_contact_handle_sync('amy at foo.com')
 
     # Divergence from Gabble: hazetest responds to all roster gets with an
     # empty roster, so we need to push the roster.
diff --git a/tests/twisted/roster/groups.py b/tests/twisted/roster/groups.py
index 0420e19..6d6fa4c 100644
--- a/tests/twisted/roster/groups.py
+++ b/tests/twisted/roster/groups.py
@@ -29,7 +29,7 @@ def test(q, bus, conn, stream):
     subscribe = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
             cs.CHANNEL_TYPE_CONTACT_LIST)
 
-    romeo, juliet, duncan = conn.RequestHandles(cs.HT_CONTACT,
+    romeo, juliet, duncan = conn.get_contact_handles_sync(
             ['romeo at montague.lit', 'juliet at capulet.lit',
                 'duncan at scotland.lit'])
 
diff --git a/tests/twisted/roster/publish.py b/tests/twisted/roster/publish.py
index e8f5b2d..791f097 100644
--- a/tests/twisted/roster/publish.py
+++ b/tests/twisted/roster/publish.py
@@ -52,7 +52,7 @@ def test(q, bus, conn, stream):
     assertEquals(set(), jids)
 
     # receive a subscription request
-    alice = conn.RequestHandles(cs.HT_CONTACT, ['alice at wonderland.lit'])[0]
+    alice = conn.get_contact_handle_sync('alice at wonderland.lit')
 
     presence = domish.Element(('jabber:client', 'presence'))
     presence['from'] = 'alice at wonderland.lit'
@@ -124,8 +124,7 @@ def test(q, bus, conn, stream):
     assertEquals(set([alice]), set(def_group.Group.GetMembers()))
 
     # receive another subscription request
-    queen = conn.RequestHandles(cs.HT_CONTACT,
-            ['queen.of.hearts at wonderland.lit'])[0]
+    queen = conn.get_contact_handle_sync('queen.of.hearts at wonderland.lit')
 
     presence = domish.Element(('jabber:client', 'presence'))
     presence['from'] = 'queen.of.hearts at wonderland.lit'
diff --git a/tests/twisted/roster/removed-from-rp-subscribe.py b/tests/twisted/roster/removed-from-rp-subscribe.py
index 8550cba..d7a5059 100644
--- a/tests/twisted/roster/removed-from-rp-subscribe.py
+++ b/tests/twisted/roster/removed-from-rp-subscribe.py
@@ -40,7 +40,7 @@ def test(q, bus, conn, stream, remove, local):
     publish = wrap_channel(bus.get_object(conn.bus_name, e.value[1]),
             cs.CHANNEL_TYPE_CONTACT_LIST)
 
-    h = conn.RequestHandles(cs.HT_CONTACT, [jid])[0]
+    h = conn.get_contact_handle_sync(jid)
 
     # Another client logged into our account (Gajim, say) wants to subscribe to
     # Marco's presence. First, per RFC 3921 it 'SHOULD perform a "roster set"
diff --git a/tests/twisted/simple-caps.py b/tests/twisted/simple-caps.py
index d580c82..c1dff88 100644
--- a/tests/twisted/simple-caps.py
+++ b/tests/twisted/simple-caps.py
@@ -53,11 +53,11 @@ def test_someone_else(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged',
             args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
 
-    bob_handle = conn.RequestHandles(cs.HT_CONTACT, ['bob at foo.com'])[0]
+    bob_handle = conn.get_contact_handle_sync('bob at foo.com')
     check_rccs(conn, bob_handle)
 
     # now a randomer who isn't even in our contact list
-    amy_handle = conn.RequestHandles(cs.HT_CONTACT, ['amy at foo.com'])[0]
+    amy_handle = conn.get_contact_handle_sync('amy at foo.com')
     check_rccs(conn, amy_handle)
 
 if __name__ == '__main__':
diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py
index 5860219..aac3f94 100644
--- a/tests/twisted/text/destroy.py
+++ b/tests/twisted/text/destroy.py
@@ -15,10 +15,7 @@ def test(q, bus, conn, stream):
     self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.get_contact_handle_sync(jid)
 
     call_async(q, conn, 'RequestChannel',
         'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
diff --git a/tests/twisted/text/ensure.py b/tests/twisted/text/ensure.py
index 2aebf8c..e4b7538 100644
--- a/tests/twisted/text/ensure.py
+++ b/tests/twisted/text/ensure.py
@@ -17,10 +17,7 @@ def test(q, bus, conn, stream):
     self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
 
     jids = ['foo at bar.com', 'truc at cafe.fr']
-    call_async(q, conn, 'RequestHandles', 1, jids)
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    handles = event.value[0]
+    handles = conn.get_contact_handles_sync(jids)
 
     properties = conn.GetAll(
             'org.freedesktop.Telepathy.Connection.Interface.Requests',
diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py
index 9e52c34..c543b69 100644
--- a/tests/twisted/text/initiate-requestotron.py
+++ b/tests/twisted/text/initiate-requestotron.py
@@ -15,10 +15,7 @@ def test(q, bus, conn, stream):
     self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.get_contact_handle_sync(jid)
 
     properties = conn.GetAll(
             'org.freedesktop.Telepathy.Connection.Interface.Requests',
diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py
index e93d318..70fcc92 100644
--- a/tests/twisted/text/initiate.py
+++ b/tests/twisted/text/initiate.py
@@ -14,10 +14,7 @@ def test(q, bus, conn, stream):
     self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.get_contact_handle_sync(jid)
 
     call_async(q, conn, 'RequestChannel',
         'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py
index 52b5e88..6cc0266 100644
--- a/tests/twisted/text/respawn.py
+++ b/tests/twisted/text/respawn.py
@@ -14,10 +14,7 @@ def test(q, bus, conn, stream):
     self_handle = conn.Properties.Get(cs.CONN, "SelfHandle")
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.get_contact_handle_sync(jid)
 
     call_async(q, conn, 'RequestChannel',
         'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)



More information about the telepathy-commits mailing list