From df1aedcdefbe96ff26fdff97aade4dcca6ad6485 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 8 Jan 2014 13:04:12 +0000 Subject: [PATCH 3/5] tests: abolish Contacts interface As with Gabble, I kept conn.Contacts working for now, but it's now an alias for the default interface. --- tests/twisted/avahi/caps-file-transfer.py | 16 +++++++--------- tests/twisted/cm/protocol.py | 1 - tests/twisted/constants.py | 1 - tests/twisted/servicetest.py | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/twisted/avahi/caps-file-transfer.py b/tests/twisted/avahi/caps-file-transfer.py index 13425c2..30c3ad0 100644 --- a/tests/twisted/avahi/caps-file-transfer.py +++ b/tests/twisted/avahi/caps-file-transfer.py @@ -99,7 +99,6 @@ def caps_contain(event, cap): def test_ft_caps_from_contact(q, bus, conn, client): conn_caps_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACT_CAPS) - conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) # send presence with FT capa ver = compute_caps_hash([], [ns.IQ_OOB], {}) @@ -121,7 +120,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): assert query_node.attributes['node'] == \ client + '#' + ver, (query_node.attributes['node'], client, ver) - contact_handle = conn_contacts_iface.GetContactByID(contact_name, [])[0] + contact_handle = conn.GetContactByID(contact_name, [])[0] # send good reply result = make_result_iq(event.stanza) @@ -139,7 +138,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): assertContains(ft_caps, caps) # check the Contacts interface give the same caps - caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( + caps_via_contacts_iface = conn.GetContactAttributes( [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -176,7 +175,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): assert query_node.attributes['node'] == \ client + '#' + ver, (query_node.attributes['node'], client, ver) - contact_handle = conn_contacts_iface.GetContactByID(contact_name, [])[0] + contact_handle = conn.GetContactByID(contact_name, [])[0] # send good reply result = make_result_iq(event.stanza) @@ -193,7 +192,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): assertDoesNotContain(ft_caps, caps) # check the Contacts interface give the same caps - caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( + caps_via_contacts_iface = conn.GetContactAttributes( [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -201,7 +200,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # no capabilites announced (assume FT is supported to insure interop) txt_record = { "txtvers": "1", "status": "avail"} contact_name = "test-caps-ft-no-capa2@" + get_host_name() - contact_handle = conn_contacts_iface.GetContactByID(contact_name, [])[0] + contact_handle = conn.GetContactByID(contact_name, [])[0] listener, port = setup_stream_listener(q, contact_name) announcer = AvahiAnnouncer(contact_name, "_presence._tcp", port, txt_record) @@ -214,7 +213,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): assertContains(ft_caps, caps) # check the Contacts interface give the same caps - caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( + caps_via_contacts_iface = conn.GetContactAttributes( [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -229,8 +228,7 @@ def test(q, bus, conn): # check our own capabilities self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") - conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) - caps = conn_contacts_iface.GetContactAttributes( + caps = conn.GetContactAttributes( [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ [self_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assertContains(ft_metadata_caps, caps) diff --git a/tests/twisted/cm/protocol.py b/tests/twisted/cm/protocol.py index 157c6b6..9b11e18 100644 --- a/tests/twisted/cm/protocol.py +++ b/tests/twisted/cm/protocol.py @@ -38,7 +38,6 @@ def test(q, bus, conn): assertContains(cs.CONN_IFACE_ALIASING, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_AVATARS, proto_props['ConnectionInterfaces']) - assertContains(cs.CONN_IFACE_CONTACTS, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_PRESENCE, proto_props['ConnectionInterfaces']) assertContains(cs.CONN_IFACE_REQUESTS, proto_props['ConnectionInterfaces']) diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index 8b428fa..a624ab0 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -186,7 +186,6 @@ CONTACT_LIST_STATE_SUCCESS = 3 CONN = PREFIX + ".Connection" CONN_IFACE_AVATARS = CONN + '.Interface.Avatars1' CONN_IFACE_ALIASING = CONN + '.Interface.Aliasing1' -CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts' CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities1' CONN_IFACE_CONTACT_INFO = CONN + ".Interface.ContactInfo1" CONN_IFACE_PRESENCE = CONN + '.Interface.Presence1' diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py index 8d07116..e997569 100644 --- a/tests/twisted/servicetest.py +++ b/tests/twisted/servicetest.py @@ -626,9 +626,9 @@ def wrap_connection(conn): return ConnWrapper(conn, tp_name_prefix + '.Connection', dict( [('Peer', 'org.freedesktop.DBus.Peer'), + ('Contacts', cs.CONN), # backwards compat with Telepathy 0 ('Aliasing', cs.CONN_IFACE_ALIASING), ('Avatars', cs.CONN_IFACE_AVATARS), - ('Contacts', cs.CONN_IFACE_CONTACTS), ('ContactCapabilities', cs.CONN_IFACE_CONTACT_CAPS), ('ContactInfo', cs.CONN_IFACE_CONTACT_INFO), ('Location', cs.CONN_IFACE_LOCATION), -- 1.8.5.2