telepathy-gabble: test-location: stop using GetLocations()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Fri Oct 11 14:58:34 PDT 2013


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

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Thu Oct 10 12:37:50 2013 -0400

test-location: stop using GetLocations()

It's removed in Telepathy 1.0

---

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

diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py
index 92c5941..2a29700 100644
--- a/tests/twisted/test-location.py
+++ b/tests/twisted/test-location.py
@@ -17,6 +17,10 @@ import ns
 
 Rich_Presence_Access_Control_Type_Publish_List = 1
 
+def get_location(conn, contact):
+    h2asv = conn.Contacts.GetContactAttributes([contact], [cs.CONN_IFACE_LOCATION], False)
+    return h2asv[contact].get(cs.ATTR_LOCATION)
+
 def test(q, bus, conn, stream):
     # we don't yet know we have PEP
     assertEquals(0, conn.Get(cs.CONN_IFACE_LOCATION,
@@ -159,7 +163,6 @@ def test(q, bus, conn, stream):
 
     # Request Bob's location
     bob_handle = conn.get_contact_handle_sync('bob at foo.com')
-    call_async(q, conn.Location, 'GetLocations', [bob_handle])
 
     # Gabble should not send a pubsub query. The point of PEP is that we don't
     # have to do this.
@@ -167,11 +170,9 @@ def test(q, bus, conn, stream):
         query_ns=ns.PUBSUB)
     q.forbid_events([ pubsub_get_pattern ])
 
-    # GetLocations returns immediately.
-    get_locations = q.expect('dbus-return', method='GetLocations')
-    locations = get_locations.value[0]
+    location = get_location(conn, bob_handle)
     # Location isn't known yet
-    assertLength(0, locations)
+    assertEquals(None, location)
 
     # Sync the XMPP stream to ensure Gabble hasn't sent a query.
     sync_stream(q, stream)
@@ -210,9 +211,8 @@ def test(q, bus, conn, stream):
     assertEquals(location['timestamp'], date)
 
     # Get location again; Gabble should return the cached location
-    locations = conn.Location.GetLocations([bob_handle])
-    assertLength(1, locations)
-    assertEquals(locations[bob_handle], location)
+    loc = get_location(conn, bob_handle)
+    assertEquals(loc, location)
 
     charles_handle = conn.get_contact_handle_sync('charles at foo.com')
 



More information about the telepathy-commits mailing list