diff options
-rw-r--r-- | tests/twisted/caps/caps-cache.py | 4 | ||||
-rw-r--r-- | tests/twisted/caps/hashed-caps.py | 15 | ||||
-rw-r--r-- | tests/twisted/caps/jingle-caps.py | 5 | ||||
-rw-r--r-- | tests/twisted/caps/offline.py | 3 | ||||
-rw-r--r-- | tests/twisted/caps/receive-jingle.py | 8 | ||||
-rw-r--r-- | tests/twisted/caps/tube-caps.py | 16 | ||||
-rw-r--r-- | tests/twisted/file-transfer/ft-client-caps.py | 18 | ||||
-rw-r--r-- | tests/twisted/file-transfer/test-caps-file-transfer.py | 13 | ||||
-rw-r--r-- | tests/twisted/jingle-share/file_transfer_helper.py | 8 | ||||
-rw-r--r-- | tests/twisted/jingle-share/jingleshareutils.py | 10 | ||||
-rw-r--r-- | tests/twisted/jingle-share/test-caps-file-transfer.py | 6 |
11 files changed, 54 insertions, 52 deletions
diff --git a/tests/twisted/caps/caps-cache.py b/tests/twisted/caps/caps-cache.py index b443bd92a..0102d5ceb 100644 --- a/tests/twisted/caps/caps-cache.py +++ b/tests/twisted/caps/caps-cache.py @@ -13,7 +13,7 @@ import ns from caps_helper import ( compute_caps_hash, fake_client_dataforms, presence_and_disco, send_presence, expect_disco, send_disco_reply, - assert_rccs_callable) + assert_rccs_callable, get_contacts_capabilities_sync) from config import VOIP_ENABLED @@ -40,7 +40,7 @@ def expect_caps(q, conn, h): check_caps(conn, h) def check_caps(conn, h): - caps = conn.ContactCapabilities.GetContactCapabilities([h]) + caps = get_contacts_capabilities_sync(conn, [h]) assert_rccs_callable(caps[h], require_video=True) def update_contact_caps(q, conn, stream, contact, caps, disco = True, diff --git a/tests/twisted/caps/hashed-caps.py b/tests/twisted/caps/hashed-caps.py index 11f7374af..ce0ca5f57 100644 --- a/tests/twisted/caps/hashed-caps.py +++ b/tests/twisted/caps/hashed-caps.py @@ -32,7 +32,8 @@ import constants as cs import ns from caps_helper import ( compute_caps_hash, make_caps_disco_reply, send_disco_reply, - fake_client_dataforms, assert_rccs_callable, assert_rccs_not_callable) + fake_client_dataforms, assert_rccs_callable, assert_rccs_not_callable, + get_contacts_capabilities_sync) from config import VOIP_ENABLED @@ -60,7 +61,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client): (2, u'available', 'hello')}]) # no special capabilities - for rcc in conn.ContactCapabilities.GetContactCapabilities([contact_handle])[contact_handle]: + for rcc in get_contacts_capabilities_sync(conn, [contact_handle])[contact_handle]: assertEquals(cs.CHANNEL_TYPE_TEXT, rcc[0].get(cs.CHANNEL_TYPE)) # send updated presence with Jingle caps info @@ -87,7 +88,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client): assert_rccs_callable(cc.args[0][contact_handle]) assertEquals(cc.args[0], - conn.ContactCapabilities.GetContactCapabilities([contact_handle])) + get_contacts_capabilities_sync(conn, [contact_handle])) # Send presence without any capabilities. XEP-0115 §8.4 Caps Optimization # says “receivers of presence notifications MUST NOT expect an annotation @@ -98,7 +99,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client): args=[{contact_handle: (2, u'available', 'very capable')}]) # still exactly the same capabilities assertEquals(cc.args[0], - conn.ContactCapabilities.GetContactCapabilities([contact_handle])) + get_contacts_capabilities_sync(conn, [contact_handle])) # send bogus presence caps = { @@ -159,7 +160,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client): assertEquals(cs.CHANNEL_TYPE_TEXT, rcc[0].get(cs.CHANNEL_TYPE)) assert_rccs_not_callable(cc.args[0][contact_handle]) assertEquals(cc.args[0], - conn.ContactCapabilities.GetContactCapabilities([contact_handle])) + get_contacts_capabilities_sync(conn, [contact_handle])) # send correct presence ver = compute_caps_hash(some_identities, jingle_av_features, fake_client_dataforms) @@ -193,7 +194,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client): ) assert_rccs_callable(cc.args[0][contact_handle]) assertEquals(cc.args[0], - conn.ContactCapabilities.GetContactCapabilities([contact_handle])) + get_contacts_capabilities_sync(conn, [contact_handle])) def test_two_clients(q, bus, conn, stream, contact1, contact2, contact_handle1, contact_handle2, client, broken_hash): @@ -214,7 +215,7 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2, # no special capabilities for h in (contact_handle1, contact_handle2): - for rcc in conn.ContactCapabilities.GetContactCapabilities([h])[h]: + for rcc in get_contacts_capabilities_sync(conn, [h])[h]: assertEquals(cs.CHANNEL_TYPE_TEXT, rcc[0].get(cs.CHANNEL_TYPE)) # send updated presence with Jingle caps info diff --git a/tests/twisted/caps/jingle-caps.py b/tests/twisted/caps/jingle-caps.py index 692b60de7..4b142059b 100644 --- a/tests/twisted/caps/jingle-caps.py +++ b/tests/twisted/caps/jingle-caps.py @@ -13,7 +13,8 @@ from servicetest import ( ) import constants as cs import ns -from caps_helper import presence_and_disco, compute_caps_hash, send_presence +from caps_helper import (presence_and_disco, compute_caps_hash, send_presence, + get_contacts_capabilities_sync) from jingle.jingletest2 import JingleTest2, JingleProtocol031 from call_helper import CallTest @@ -72,7 +73,7 @@ def test_caps(q, conn, stream, contact, features, audio, video, google=False): # Check Contact capabilities assertEquals(len(event.args), 1) assertEquals (event.args[0], - conn.ContactCapabilities.GetContactCapabilities([h])) + get_contacts_capabilities_sync(conn, [h])) check_contact_caps (event.args[0][h], cs.CHANNEL_TYPE_CALL, call_expected_media_caps) diff --git a/tests/twisted/caps/offline.py b/tests/twisted/caps/offline.py index f448c0e4f..dea958b72 100644 --- a/tests/twisted/caps/offline.py +++ b/tests/twisted/caps/offline.py @@ -4,6 +4,7 @@ Test for fd.o#32874 -- Offline contacts do not have capabilities. from gabbletest import exec_test from servicetest import assertEquals, assertSameSets, assertLength +from caps_helper import get_contacts_capabilities_sync import constants as cs import ns @@ -29,7 +30,7 @@ def test(q, bus, conn, stream): bob_handle = conn.get_contact_handle_sync(jid) # new ContactCapabilities - ccaps_map = conn.ContactCapabilities.GetContactCapabilities([bob_handle]) + ccaps_map = get_contacts_capabilities_sync(conn, [bob_handle]) assertLength(1, ccaps_map) assertLength(1, ccaps_map[bob_handle]) diff --git a/tests/twisted/caps/receive-jingle.py b/tests/twisted/caps/receive-jingle.py index 90ee8e745..c35d0dbb8 100644 --- a/tests/twisted/caps/receive-jingle.py +++ b/tests/twisted/caps/receive-jingle.py @@ -7,7 +7,7 @@ import dbus from servicetest import EventPattern, assertEquals, sync_dbus from gabbletest import exec_test, make_result_iq, make_presence, sync_stream from caps_helper import (assert_rccs_callable, assert_rccs_not_callable, - check_rccs_callable) + check_rccs_callable, get_contacts_capabilities_sync) import constants as cs from config import VOIP_ENABLED @@ -28,14 +28,14 @@ def test(q, bus, conn, stream): basic_caps = [(bob, cs.CHANNEL_TYPE_TEXT, 3, 0)] # only Text - for rcc in conn.ContactCapabilities.GetContactCapabilities([bob])[bob]: + for rcc in get_contacts_capabilities_sync(conn, [bob])[bob]: assertEquals(cs.CHANNEL_TYPE_TEXT, rcc[0].get(cs.CHANNEL_TYPE)) # holding the handle here: see below assertEquals( { bob: { cs.ATTR_CONTACT_CAPABILITIES: - conn.ContactCapabilities.GetContactCapabilities([bob])[bob], + get_contacts_capabilities_sync(conn, [bob])[bob], cs.CONN + '/contact-id': 'bob@foo.com', }, }, @@ -141,7 +141,7 @@ def test(q, bus, conn, stream): # became invalid, but that's not guaranteed to happen immediately; so we # now hold the handle (above), to guarantee that it does *not* become # invalid. - rccs = conn.ContactCapabilities.GetContactCapabilities([bob])[bob] + rccs = get_contacts_capabilities_sync(conn, [bob])[bob] for rcc in rccs: assertEquals(cs.CHANNEL_TYPE_TEXT, rcc[0].get(cs.CHANNEL_TYPE)) diff --git a/tests/twisted/caps/tube-caps.py b/tests/twisted/caps/tube-caps.py index 3a3016836..1ceb6f8b5 100644 --- a/tests/twisted/caps/tube-caps.py +++ b/tests/twisted/caps/tube-caps.py @@ -47,7 +47,7 @@ import constants as cs from caps_helper import compute_caps_hash, text_fixed_properties,\ text_allowed_properties, stream_tube_fixed_properties, stream_tube_allowed_properties,\ dbus_tube_fixed_properties, dbus_tube_allowed_properties, receive_presence_and_ask_caps,\ - caps_contain, ft_fixed_properties, ft_allowed_properties + caps_contain, ft_fixed_properties, ft_allowed_properties, get_contacts_capabilities_sync import ns specialized_tube_allowed_properties = dbus.Array([cs.TARGET_HANDLE, @@ -130,11 +130,11 @@ def receive_caps(q, conn, stream, contact, contact_handle, features, # Make sure Gabble's got the caps sync_stream(q, stream) - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assertSameElements(expected_caps, caps) # test again, to check GetContactCapabilities does not have side effect - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assertSameElements(expected_caps, caps) # check the Contacts interface give the same caps @@ -148,7 +148,7 @@ def test_tube_caps_from_contact(q, bus, conn, stream, contact): # Check that we don't crash if we haven't seen any caps/presence for this # contact yet. - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) basic_caps = dbus.Dictionary({contact_handle: [(text_fixed_properties, text_allowed_properties)]}) @@ -245,7 +245,7 @@ def advertise_caps(q, conn, stream, filters, expected_features, unexpected_featu assertDoesNotContain(var, namespaces) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertSameElements(expected_caps, caps) # check the Contacts interface give the same caps @@ -292,7 +292,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): (ft_fixed_properties, ft_allowed_properties)]}) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertEquals(basic_caps, caps) # check the Contacts interface give the same caps @@ -306,7 +306,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): [(cs.CLIENT + '.Foo', {}, [])]) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertLength(1, caps) assertEquals(basic_caps, caps) @@ -323,7 +323,7 @@ def test_tube_caps_to_contact(q, bus, conn, stream): [(cs.CLIENT + '.Foo', [outgoing_daap_fixed_properties], [])]) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertLength(1, caps) assertEquals(basic_caps, caps) diff --git a/tests/twisted/file-transfer/ft-client-caps.py b/tests/twisted/file-transfer/ft-client-caps.py index 87cdf3701..f8c65c940 100644 --- a/tests/twisted/file-transfer/ft-client-caps.py +++ b/tests/twisted/file-transfer/ft-client-caps.py @@ -45,7 +45,7 @@ from caps_helper import compute_caps_hash, text_fixed_properties,\ text_allowed_properties, stream_tube_fixed_properties, stream_tube_allowed_properties,\ dbus_tube_fixed_properties, dbus_tube_allowed_properties, receive_presence_and_ask_caps,\ ft_fixed_properties, ft_allowed_properties, ft_allowed_properties_with_metadata, \ - presence_and_disco + presence_and_disco, get_contacts_capabilities_sync import ns from config import FILE_TRANSFER_ENABLED @@ -103,11 +103,11 @@ def receive_caps(q, conn, stream, contact, contact_handle, features, # Make sure Gabble's got the caps sync_stream(q, stream) - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assertSameElements(expected_caps, caps[contact_handle]) # test again, to check GetContactCapabilities does not have side effect - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assertSameElements(expected_caps, caps[contact_handle]) # check the Contacts interface give the same caps @@ -121,7 +121,7 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact): # Check that we don't crash if we haven't seen any caps/presence for this # contact yet. - caps = conn.ContactCapabilities.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) basic_caps = [(text_fixed_properties, text_allowed_properties)] @@ -195,7 +195,7 @@ def advertise_caps(q, bus, conn, stream, filters, expected_features, unexpected_ assertDoesNotContain(var, namespaces) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertSameElements(expected_caps, caps[self_handle]) # check the Contacts interface give the same caps @@ -231,7 +231,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): # # Check our own caps; we should have no FT caps # - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertEquals(basic_caps, caps[self_handle]) # check the Contacts interface give the same caps @@ -247,7 +247,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): [(cs.CLIENT + '.Foo', {}, [])]) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertLength(1, caps) assertEquals(basic_caps, caps[self_handle]) @@ -266,7 +266,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): [(cs.CLIENT + '.Foo', [no_service_fixed_properties], [])]) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertLength(1, caps) assertEquals(simple_ft_caps, caps[self_handle]) @@ -285,7 +285,7 @@ def test_ft_caps_to_contact(q, bus, conn, stream): [(cs.CLIENT + '.Foo', [outgoing_daap_fixed_properties], [])]) # Check our own caps - caps = conn.ContactCapabilities.GetContactCapabilities([self_handle]) + caps = get_contacts_capabilities_sync(conn, [self_handle]) assertLength(1, caps) assertEquals(simple_ft_caps, caps[self_handle]) diff --git a/tests/twisted/file-transfer/test-caps-file-transfer.py b/tests/twisted/file-transfer/test-caps-file-transfer.py index dd69e53c7..c7d6c9b30 100644 --- a/tests/twisted/file-transfer/test-caps-file-transfer.py +++ b/tests/twisted/file-transfer/test-caps-file-transfer.py @@ -5,8 +5,9 @@ from twisted.words.xish import xpath from gabbletest import exec_test, make_result_iq, sync_stream, make_presence import constants as cs -from caps_helper import compute_caps_hash, text_fixed_properties,\ - text_allowed_properties, ft_fixed_properties, ft_allowed_properties +from caps_helper import (compute_caps_hash, text_fixed_properties, + text_allowed_properties, ft_fixed_properties, ft_allowed_properties, + get_contacts_capabilities_sync) import ns @@ -47,10 +48,10 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli # no special capabilities basic_caps = dbus.Dictionary({contact_handle: [(text_fixed_properties, text_allowed_properties)]}) - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == basic_caps, caps # test again, to check GetContactCapabilities does not have side effect - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == basic_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( @@ -89,10 +90,10 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert len(event.args) == 1 assert event.args[0] == generic_tubes_caps - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == generic_tubes_caps, caps # test again, to check GetContactCapabilities does not have side effect - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == generic_tubes_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( diff --git a/tests/twisted/jingle-share/file_transfer_helper.py b/tests/twisted/jingle-share/file_transfer_helper.py index f27cd8960..f917df2f6 100644 --- a/tests/twisted/jingle-share/file_transfer_helper.py +++ b/tests/twisted/jingle-share/file_transfer_helper.py @@ -11,7 +11,7 @@ from caps_helper import text_fixed_properties, text_allowed_properties, \ stream_tube_fixed_properties, stream_tube_allowed_properties, \ dbus_tube_fixed_properties, dbus_tube_allowed_properties, \ ft_fixed_properties, ft_allowed_properties, compute_caps_hash, \ - extract_disco_parts + extract_disco_parts, get_contacts_capabilities_sync from twisted.words.xish import domish, xpath @@ -92,15 +92,13 @@ class FileTransferTest(object): args=[{self.self_handle:generic_ft_caps}]) def wait_for_ft_caps(self): - conn_caps_iface = dbus.Interface(self.conn, cs.CONN_IFACE_CONTACT_CAPS) - - caps = conn_caps_iface.GetContactCapabilities([self.handle]) + caps = get_contacts_capabilities_sync(self.conn, [self.handle]) if caps != dbus.Dictionary({self.handle:generic_ft_caps}): self.q.expect('dbus-signal', signal='ContactCapabilitiesChanged', path=self.conn.object.object_path, args=[{self.handle:generic_ft_caps}]) - caps = conn_caps_iface.GetContactCapabilities([self.handle]) + caps = get_contacts_capabilities_sync(self.conn, [self.handle]) assert caps == dbus.Dictionary({self.handle:generic_ft_caps}), caps def create_ft_channel(self): diff --git a/tests/twisted/jingle-share/jingleshareutils.py b/tests/twisted/jingle-share/jingleshareutils.py index 151771fd0..21030dc4d 100644 --- a/tests/twisted/jingle-share/jingleshareutils.py +++ b/tests/twisted/jingle-share/jingleshareutils.py @@ -8,7 +8,7 @@ import constants as cs from caps_helper import compute_caps_hash, \ text_fixed_properties, text_allowed_properties, \ - ft_fixed_properties, ft_allowed_properties + ft_fixed_properties, ft_allowed_properties, get_contacts_capabilities_sync import ns @@ -47,10 +47,10 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli # no special capabilities basic_caps = dbus.Dictionary({contact_handle: [(text_fixed_properties, text_allowed_properties)]}) - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == basic_caps, caps # test again, to check GetContactCapabilities does not have side effect - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == basic_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( @@ -89,10 +89,10 @@ def test_ft_caps_from_contact(q, bus, conn, stream, contact, contact_handle, cli assert len(event.args) == 1 assert event.args[0] == generic_ft_caps - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == generic_ft_caps, caps # test again, to check GetContactCapabilities does not have side effect - caps = conn_caps_iface.GetContactCapabilities([contact_handle]) + caps = get_contacts_capabilities_sync(conn, [contact_handle]) assert caps == generic_ft_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( diff --git a/tests/twisted/jingle-share/test-caps-file-transfer.py b/tests/twisted/jingle-share/test-caps-file-transfer.py index b78b99787..f3be084ed 100644 --- a/tests/twisted/jingle-share/test-caps-file-transfer.py +++ b/tests/twisted/jingle-share/test-caps-file-transfer.py @@ -10,7 +10,8 @@ from caps_helper import \ text_fixed_properties, text_allowed_properties, \ stream_tube_fixed_properties, stream_tube_allowed_properties, \ dbus_tube_fixed_properties, dbus_tube_allowed_properties, \ - ft_fixed_properties, ft_allowed_properties_with_metadata + ft_fixed_properties, ft_allowed_properties_with_metadata,\ + get_contacts_capabilities_sync import ns from jingleshareutils import test_ft_caps_from_contact @@ -43,7 +44,6 @@ generic_caps = [(text_fixed_properties, text_allowed_properties), (dbus_tube_fixed_properties, dbus_tube_allowed_properties)] def check_contact_caps(conn, handle, with_ft): - conn_caps_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACT_CAPS) conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) if with_ft: @@ -51,7 +51,7 @@ def check_contact_caps(conn, handle, with_ft): else: expected_caps = dbus.Dictionary({handle: generic_caps}) - caps = conn_caps_iface.GetContactCapabilities([handle]) + caps = get_contacts_capabilities_sync(conn, [handle]) assert caps == expected_caps, caps # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( |