From 9eff9730666d80050c8bfd533361cf49ea8543c2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 23 Sep 2013 13:02:31 +0100 Subject: [PATCH 04/16] Use get_contact_handle_sync, get_contact_handles_sync Telepathy 1.0 won't have RequestHandles. --- 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@foo.com'])[0] + amy_handle = conn.get_contact_handle_sync('amy@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@montague.lit', 'juliet@capulet.lit', 'duncan@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@wonderland.lit'])[0] + alice = conn.get_contact_handle_sync('alice@wonderland.lit') presence = domish.Element(('jabber:client', 'presence')) presence['from'] = 'alice@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@wonderland.lit'])[0] + queen = conn.get_contact_handle_sync('queen.of.hearts@wonderland.lit') presence = domish.Element(('jabber:client', 'presence')) presence['from'] = 'queen.of.hearts@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@foo.com'])[0] + bob_handle = conn.get_contact_handle_sync('bob@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@foo.com'])[0] + amy_handle = conn.get_contact_handle_sync('amy@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@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@bar.com', 'truc@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@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@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@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) -- 1.8.4.rc3