diff options
Diffstat (limited to 'tests/twisted/avahi')
-rw-r--r-- | tests/twisted/avahi/aliases.py | 11 | ||||
-rw-r--r-- | tests/twisted/avahi/caps-file-transfer.py | 8 | ||||
-rw-r--r-- | tests/twisted/avahi/caps-self.py | 2 | ||||
-rw-r--r-- | tests/twisted/avahi/close-local-pending-room.py | 10 | ||||
-rw-r--r-- | tests/twisted/avahi/file-transfer/file_transfer_helper.py | 10 | ||||
-rw-r--r-- | tests/twisted/avahi/file-transfer/ft-client-caps.py | 14 | ||||
-rw-r--r-- | tests/twisted/avahi/ichat-composing.py | 8 | ||||
-rw-r--r-- | tests/twisted/avahi/ichat-incoming-msg.py | 10 | ||||
-rw-r--r-- | tests/twisted/avahi/muc-invite.py | 11 | ||||
-rw-r--r-- | tests/twisted/avahi/olpc-activity-announcements.py | 115 | ||||
-rw-r--r-- | tests/twisted/avahi/request-im.py | 8 | ||||
-rw-r--r-- | tests/twisted/avahi/request-muc.py | 6 | ||||
-rw-r--r-- | tests/twisted/avahi/roomlist.py | 11 | ||||
-rw-r--r-- | tests/twisted/avahi/set-presence.py | 4 | ||||
-rw-r--r-- | tests/twisted/avahi/text-channel.py | 15 | ||||
-rw-r--r-- | tests/twisted/avahi/tubes/request-muc-tubes.py | 6 | ||||
-rw-r--r-- | tests/twisted/avahi/tubes/tubetestutil.py | 10 | ||||
-rw-r--r-- | tests/twisted/avahi/tubes/two-muc-dbus-tubes.py | 4 |
18 files changed, 196 insertions, 67 deletions
diff --git a/tests/twisted/avahi/aliases.py b/tests/twisted/avahi/aliases.py index 799bd54f..41c82857 100644 --- a/tests/twisted/avahi/aliases.py +++ b/tests/twisted/avahi/aliases.py @@ -13,8 +13,8 @@ import time def wait_for_aliases_changed(q, handle): e = q.expect('dbus-signal', signal='AliasesChanged', - predicate=lambda e: handle in e.args[0]) - alias = e.args[0][handle] + predicate=lambda e: e.args[0][0][0] == handle) + _, alias = e.args[0][0] return alias def wait_for_contact_info_changed(q, handle): @@ -57,7 +57,7 @@ def check_contact_info(info, txt): def check_all_contact_info_methods(conn, handle, keys): attrs = conn.Contacts.GetContactAttributes([handle], - [cs.CONN_IFACE_CONTACT_INFO])[handle] + [cs.CONN_IFACE_CONTACT_INFO], True)[handle] info = attrs[cs.CONN_IFACE_CONTACT_INFO + "/info"] check_contact_info(info, keys) @@ -69,9 +69,6 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED]) - flags = conn.Properties.Get(cs.CONN_IFACE_ALIASING, "AliasFlags") - assertEquals(flags, 0) - assertContains(cs.CONN_IFACE_CONTACT_INFO, conn.Properties.Get(cs.CONN, "Interfaces")) ci_props = conn.Properties.GetAll(cs.CONN_IFACE_CONTACT_INFO) @@ -130,7 +127,7 @@ def test(q, bus, conn): check_contact_info(info, dict) attrs = conn.Contacts.GetContactAttributes([handle], - [cs.CONN_IFACE_ALIASING])[handle] + [cs.CONN_IFACE_ALIASING], True)[handle] assertEquals(alias, attrs[cs.CONN_IFACE_ALIASING + "/alias"]) check_all_contact_info_methods(conn, handle, dict) diff --git a/tests/twisted/avahi/caps-file-transfer.py b/tests/twisted/avahi/caps-file-transfer.py index 13425c26..c239fdfd 100644 --- a/tests/twisted/avahi/caps-file-transfer.py +++ b/tests/twisted/avahi/caps-file-transfer.py @@ -140,7 +140,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -194,7 +194,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -215,7 +215,7 @@ def test_ft_caps_from_contact(q, bus, conn, client): # check the Contacts interface give the same caps caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [contact_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assert caps_via_contacts_iface == caps, caps_via_contacts_iface @@ -231,7 +231,7 @@ def test(q, bus, conn): self_handle = conn.Properties.Get(cs.CONN, "SelfHandle") conn_contacts_iface = dbus.Interface(conn, cs.CONN_IFACE_CONTACTS) caps = conn_contacts_iface.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.CONN_IFACE_CONTACT_CAPS + '/capabilities'] assertContains(ft_metadata_caps, caps) diff --git a/tests/twisted/avahi/caps-self.py b/tests/twisted/avahi/caps-self.py index c176691b..4438d937 100644 --- a/tests/twisted/avahi/caps-self.py +++ b/tests/twisted/avahi/caps-self.py @@ -1,6 +1,6 @@ """ Basic test of SetSelfCapabilities on interface -im.telepathy1.Connection.Interface.ContactCapabilities +org.freedesktop.Telepathy.Connection.Interface.ContactCapabilities """ from saluttest import exec_test diff --git a/tests/twisted/avahi/close-local-pending-room.py b/tests/twisted/avahi/close-local-pending-room.py index 5066fcfd..1e04fa37 100644 --- a/tests/twisted/avahi/close-local-pending-room.py +++ b/tests/twisted/avahi/close-local-pending-room.py @@ -61,18 +61,18 @@ def test(q, bus, conn): xmpp_connection.send(message) # group channel is created - e = q.expect('dbus-signal', signal='NewChannels', + e = q.expect('dbus-signal', signal='NewChannel', predicate=lambda e: - e.args[0][0][1][cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT and - e.args[0][0][1][cs.TARGET_HANDLE_TYPE] == cs.HT_ROOM) - path = e.args[0][0][0] + e.args[1] == cs.CHANNEL_TYPE_TEXT and + e.args[2] == cs.HT_ROOM) + path = e.args[0] channel = make_channel_proxy(conn, path, 'Channel') props_iface = dbus.Interface(bus.get_object(conn.object.bus_name, path), dbus.PROPERTIES_IFACE) q.expect('dbus-signal', signal='MembersChanged', path=path) - lp_members = props_iface.Get('im.telepathy1.Channel.Interface.Group1', + lp_members = props_iface.Get('org.freedesktop.Telepathy.Channel.Interface.Group', 'LocalPendingMembers') assert len(lp_members) == 1 diff --git a/tests/twisted/avahi/file-transfer/file_transfer_helper.py b/tests/twisted/avahi/file-transfer/file_transfer_helper.py index edfb1989..cb10c6b8 100644 --- a/tests/twisted/avahi/file-transfer/file_transfer_helper.py +++ b/tests/twisted/avahi/file-transfer/file_transfer_helper.py @@ -133,7 +133,7 @@ class FileTransferTest(object): def create_ft_channel(self): self.channel = make_channel_proxy(self.conn, self.ft_path, 'Channel') - self.ft_channel = make_channel_proxy(self.conn, self.ft_path, 'Channel.Type.FileTransfer1') + self.ft_channel = make_channel_proxy(self.conn, self.ft_path, 'Channel.Type.FileTransfer') self.ft_props = dbus.Interface(self.bus.get_object( self.conn.object.bus_name, self.ft_path), PROPERTIES_IFACE) @@ -246,7 +246,7 @@ class ReceiveFileTest(FileTransferTest): path, props = channels[0] # check channel properties - # im.telepathy1.Channel D-Bus properties + # org.freedesktop.Telepathy.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER assert props[cs.INTERFACES] == [] assert props[cs.TARGET_HANDLE] == self.handle @@ -256,7 +256,7 @@ class ReceiveFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.handle assert props[cs.INITIATOR_ID] == self.contact_name - # im.telepathy1.Channel.Type.FileTransfer D-Bus properties + # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING assert props[cs.FT_CONTENT_TYPE] == self.file.content_type assert props[cs.FT_FILENAME] == self.file.name @@ -410,7 +410,7 @@ class SendFileTest(FileTransferTest): self.ft_path, props = self.conn.Requests.CreateChannel(request) - # im.telepathy1.Channel D-Bus properties + # org.freedesktop.Telepathy.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_FILE_TRANSFER assert props[cs.INTERFACES] == [] assert props[cs.TARGET_HANDLE] == self.handle @@ -420,7 +420,7 @@ class SendFileTest(FileTransferTest): assert props[cs.INITIATOR_HANDLE] == self.self_handle assert props[cs.INITIATOR_ID] == self.self_handle_name - # im.telepathy1.Channel.Type.FileTransfer D-Bus properties + # org.freedesktop.Telepathy.Channel.Type.FileTransfer D-Bus properties assert props[cs.FT_STATE] == cs.FT_STATE_PENDING assert props[cs.FT_CONTENT_TYPE] == self.file.content_type assert props[cs.FT_FILENAME] == self.file.name diff --git a/tests/twisted/avahi/file-transfer/ft-client-caps.py b/tests/twisted/avahi/file-transfer/ft-client-caps.py index 8d6bb8df..3cb6aca3 100644 --- a/tests/twisted/avahi/file-transfer/ft-client-caps.py +++ b/tests/twisted/avahi/file-transfer/ft-client-caps.py @@ -131,7 +131,7 @@ def receive_caps(q, bus, conn, service, contact, contact_handle, features, # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [contact_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(expected_caps, caps_via_contacts_iface) @@ -151,7 +151,7 @@ def test_ft_caps_from_contact(q, bus, conn, service, contact): # Check that we don't crash if we haven't seen any caps/presence for this # contact yet. caps = conn.Contacts.GetContactAttributes( - [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [contact_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [contact_handle] basic_caps = [(text_fixed_properties, text_allowed_properties)] @@ -243,7 +243,7 @@ def advertise_caps(q, bus, conn, service, filters, expected_features, unexpected # check the Contacts interface give the same caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertSameElements(expected_caps, caps_via_contacts_iface) @@ -276,7 +276,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps # caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -288,7 +288,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -302,7 +302,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) @@ -316,7 +316,7 @@ def test_ft_caps_to_contact(q, bus, conn, service): # Check our own caps caps_via_contacts_iface = conn.Contacts.GetContactAttributes( - [self_handle], [cs.CONN_IFACE_CONTACT_CAPS]) \ + [self_handle], [cs.CONN_IFACE_CONTACT_CAPS], False) \ [self_handle][cs.ATTR_CONTACT_CAPABILITIES] assertEquals(basic_caps, caps_via_contacts_iface) diff --git a/tests/twisted/avahi/ichat-composing.py b/tests/twisted/avahi/ichat-composing.py index c2057fac..ae48d8a8 100644 --- a/tests/twisted/avahi/ichat-composing.py +++ b/tests/twisted/avahi/ichat-composing.py @@ -66,11 +66,9 @@ def test(q, bus, conn): event.addElement('composing') xmpp_connection.send(message) - e = q.expect('dbus-signal', signal='MessageReceived') - assert len(e.args[0]) == 2 - assert e.args[0][0]['message-sender-id'] == contact_name - assert e.args[0][0]['message-sender'] == handle - assert e.args[0][1]['content'] == OUTGOING_MESSAGE + e = q.expect('dbus-signal', signal='Received') + assert e.args[2] == handle + assert e.args[5] == OUTGOING_MESSAGE if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/avahi/ichat-incoming-msg.py b/tests/twisted/avahi/ichat-incoming-msg.py index bbf3bf06..71812230 100644 --- a/tests/twisted/avahi/ichat-incoming-msg.py +++ b/tests/twisted/avahi/ichat-incoming-msg.py @@ -53,12 +53,10 @@ def test(q, bus, conn): boddy = msg.addElement('body', content='hi') outbound.send(msg) - e = q.expect('dbus-signal', signal='MessageReceived') - assert len(e.args[0]) == 2 - assert e.args[0][0]['message-sender-id'] == contact_name - assert e.args[0][0]['message-sender'] == handle - assert e.args[0][0]['message-type'] == cs.MT_NORMAL - assert e.args[0][1]['content'] == "hi" + e = q.expect('dbus-signal', signal='Received') + assert e.args[2] == handle + assert e.args[3] == cs.MT_NORMAL + assert e.args[5] == "hi" if __name__ == '__main__': skip_if_another_llxmpp() diff --git a/tests/twisted/avahi/muc-invite.py b/tests/twisted/avahi/muc-invite.py index 6f0a6116..abfc8f28 100644 --- a/tests/twisted/avahi/muc-invite.py +++ b/tests/twisted/avahi/muc-invite.py @@ -80,9 +80,10 @@ def test(q, bus, conn): channel_group = make_channel_proxy(conn, path, "Channel.Interface.Group") # check channel properties - # im.telepathy1.Channel D-Bus properties + # org.freedesktop.Telepathy.Channel D-Bus properties assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT assertContains(cs.CHANNEL_IFACE_GROUP, props[cs.INTERFACES]) + assertContains(cs.CHANNEL_IFACE_MESSAGES, props[cs.INTERFACES]) assert props[cs.TARGET_ID] == 'my-room' assert props[cs.TARGET_HANDLE_TYPE] == HT_ROOM assert props[cs.REQUESTED] == False @@ -91,14 +92,14 @@ def test(q, bus, conn): # we are added to local pending e = q.expect('dbus-signal', signal='MembersChanged') - added, removed, lp, rp, details = e.args - assert details['message'] == 'Inviting to this room' + msg, added, removed, lp, rp, actor, reason = e.args + assert msg == 'Inviting to this room' assert added == [] assert removed == [] assert lp == [self_handle] assert rp == [] - assert details['actor'] == handle - assert details['change-reason'] == 4 # invited + assert actor == handle + assert reason == 4 # invited # TODO: join the muc, check if we are added to remote-pending and then # to members. This would need some tweak in Salut and/or the test framework diff --git a/tests/twisted/avahi/olpc-activity-announcements.py b/tests/twisted/avahi/olpc-activity-announcements.py new file mode 100644 index 00000000..6b4d01a2 --- /dev/null +++ b/tests/twisted/avahi/olpc-activity-announcements.py @@ -0,0 +1,115 @@ +from saluttest import exec_test, wait_for_contact_in_publish +from avahitest import AvahiAnnouncer, AvahiRecordAnnouncer, AvahiListener +from avahitest import get_host_name, get_domain_name +import avahi + +from xmppstream import setup_stream_listener, connect_to_stream +from servicetest import make_channel_proxy, format_event, EventPattern + +from twisted.words.xish import xpath, domish +import constants as cs + +import time +import dbus +import socket + +CHANNEL_TYPE_TEXT = "org.freedesktop.Telepathy.Channel.Type.Text" +HT_CONTACT = 1 +HT_ROOM = 2 +HT_CONTACT_LIST = 3 + +PUBLISHED_NAME = "acttest" +TESTSUITE_PUBLISHED_NAME = "salutacttest" +ACTIVITY_ID = str(time.time()) + +def announce_address(hostname, address): + "Announce IN A record, address is assume to be ipv4" + + data = reduce (lambda x, y: (x << 8) + int(y), address.split("."), 0) + ndata = socket.htonl(data) + rdata = [ (ndata >> (24 - x)) & 0xff for x in xrange(0, 32, 8)] + + AvahiRecordAnnouncer(hostname, 0x1, 0x01, rdata) + +def test(q, bus, conn): + conn.Connect() + q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) + + + activity_txt = { "type": "org.laptop.HelloMesh", + "name": "HelloMesh", + "color": "#7b83c1,#260993", + "txtvers": "0", + "activity-id": ACTIVITY_ID, + "room": ACTIVITY_ID + } + + # Listen for announcements + l = AvahiListener(q).listen_for_service("_olpc-activity1._udp") + + # Assert that the testsuite doesn't announce the activity + service_name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME + "@" + get_host_name() + forbiden_event = EventPattern('service-added', name=service_name) + q.forbid_events([forbiden_event]) + + contact_name = PUBLISHED_NAME + "@" + get_host_name() + + activity_name = ACTIVITY_ID + ":" + PUBLISHED_NAME + "@" + get_host_name() + + AvahiAnnouncer(contact_name, "_presence._tcp", 1234, {}) + + act_hostname = ACTIVITY_ID + ":" + PUBLISHED_NAME + \ + "._clique._udp." + get_domain_name() + act_address = "239.253.70.70" + + announce_address(act_hostname, act_address) + + # FIXME, if we use the same name as the running salut will MembersChanged + # isn't signalled later on, needs to be fixed. + AvahiAnnouncer(ACTIVITY_ID + ":" + PUBLISHED_NAME, + "_clique._udp", 12345, {}, hostname = act_hostname) + AvahiAnnouncer(activity_name, "_olpc-activity1._udp", + 0, activity_txt) + + # Publish a contact, now get it's handle + handle = wait_for_contact_in_publish(q, bus, conn, contact_name) + + # Assert that the remote handles signals it joined the activity + while True: + e = q.expect('dbus-signal', signal = 'ActivitiesChanged') + if e.args[0] == handle and e.args[1] != []: + assert len(e.args[1]) == 1 + assert e.args[1][0][0] == ACTIVITY_ID + activity_handle = e.args[1][0][1] + break + + act_prop_iface = dbus.Interface(conn, cs.ACTIVITY_PROPERTIES) + act_properties = act_prop_iface.GetProperties(activity_handle) + assert act_properties['private'] == False + assert act_properties['color'] == activity_txt['color'] + assert act_properties['name'] == activity_txt['name'] + assert act_properties['type'] == activity_txt['type'] + + room_channel = conn.RequestChannel(CHANNEL_TYPE_TEXT, + HT_ROOM, activity_handle, True) + + q.expect('dbus-signal', signal='MembersChanged', path=room_channel, + args = [u'', [1L], [], [], [], 1L, 0L]) + + # Make it public that we joined the activity + q.unforbid_events([forbiden_event]) + buddy_info_iface = dbus.Interface(conn, cs.BUDDY_INFO) + buddy_info_iface.SetActivities([(ACTIVITY_ID, activity_handle)]) + + q.expect('service-added', + name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME + + "@" + get_host_name()) + + buddy_info_iface.SetActivities([]) + + q.expect('service-removed', + name = ACTIVITY_ID + ":" + TESTSUITE_PUBLISHED_NAME + + "@" + get_host_name()) + +if __name__ == '__main__': + exec_test(test, { "published-name": TESTSUITE_PUBLISHED_NAME}, timeout=15) diff --git a/tests/twisted/avahi/request-im.py b/tests/twisted/avahi/request-im.py index 93e3abf7..d7d2141e 100644 --- a/tests/twisted/avahi/request-im.py +++ b/tests/twisted/avahi/request-im.py @@ -5,11 +5,13 @@ Test requesting of text 1-1 channels using the old and new request API. import dbus -from saluttest import (exec_test, wait_for_contact_in_publish) +from saluttest import (exec_test, wait_for_contact_list, + wait_for_contact_in_publish) from servicetest import call_async, EventPattern, \ tp_name_prefix, make_channel_proxy from avahitest import get_host_name, AvahiAnnouncer from xmppstream import setup_stream_listener + import constants as cs def test(q, bus, conn): @@ -22,6 +24,10 @@ def test(q, bus, conn): contact_name = "test-request-im@" + get_host_name() listener, port = setup_stream_listener(q, contact_name) + # FIXME: this is a hack to be sure to have all the contact list channels + # announced so they won't interfere with the muc ones announces. + wait_for_contact_list(q, conn) + AvahiAnnouncer(contact_name, "_presence._tcp", port, basic_txt) handle = wait_for_contact_in_publish(q, bus, conn, contact_name) diff --git a/tests/twisted/avahi/request-muc.py b/tests/twisted/avahi/request-muc.py index 9ef67770..a6283b2e 100644 --- a/tests/twisted/avahi/request-muc.py +++ b/tests/twisted/avahi/request-muc.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test +from saluttest import exec_test, wait_for_contact_list from servicetest import call_async, EventPattern, \ tp_name_prefix, tp_path_prefix, make_channel_proxy @@ -21,6 +21,10 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) + # FIXME: this is a hack to be sure to have all the contact list channels + # announced so they won't interfere with the muc ones announces. + wait_for_contact_list(q, conn) + # check if we can request roomlist channels properties = conn.GetAll( tp_name_prefix + '.Connection.Interface.Requests', diff --git a/tests/twisted/avahi/roomlist.py b/tests/twisted/avahi/roomlist.py index 21fb1824..7e84a1be 100644 --- a/tests/twisted/avahi/roomlist.py +++ b/tests/twisted/avahi/roomlist.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test +from saluttest import exec_test, wait_for_contact_list from servicetest import call_async, EventPattern, \ tp_name_prefix, tp_path_prefix, wrap_channel import constants as cs @@ -20,11 +20,14 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) + # FIXME: this is a hack to be sure to have all the contact list channels + # announced so they won't interfere with the roomlist ones announces. + wait_for_contact_list(q, conn) + # check if we can request roomlist channels properties = conn.GetAll( tp_name_prefix + '.Connection.Interface.Requests', dbus_interface='org.freedesktop.DBus.Properties') - assert ({tp_name_prefix + '.Channel.ChannelType': cs.CHANNEL_TYPE_ROOM_LIST, tp_name_prefix + '.Channel.TargetHandleType': 0, @@ -48,7 +51,7 @@ def test(q, bus, conn): EventPattern('dbus-signal', signal='NewChannels'), ) path2 = ret.value[0] - chan2 = wrap_channel(bus.get_object(conn.bus_name, path2), "RoomList1") + chan2 = wrap_channel(bus.get_object(conn.bus_name, path2), "RoomList") props = ret.value[1] assert props[tp_name_prefix + '.Channel.ChannelType'] ==\ @@ -61,7 +64,7 @@ def test(q, bus, conn): == conn.Properties.Get(cs.CONN, "SelfHandle") assert props[tp_name_prefix + '.Channel.InitiatorID'] \ == self_name - assert props[tp_name_prefix + '.Channel.Type.RoomList1.Server'] == '' + assert props[tp_name_prefix + '.Channel.Type.RoomList.Server'] == '' assert new_sig.args[0][0][0] == path2 assert new_sig.args[0][0][1] == props diff --git a/tests/twisted/avahi/set-presence.py b/tests/twisted/avahi/set-presence.py index b6f38f1e..82343c4b 100644 --- a/tests/twisted/avahi/set-presence.py +++ b/tests/twisted/avahi/set-presence.py @@ -32,13 +32,13 @@ def test(q, bus, conn): assert status == 'avail', status assert msg is None, msg - statuses = conn.Get(cs.CONN_IFACE_PRESENCE, 'Statuses', dbus_interface=dbus.PROPERTIES_IFACE) + statuses = conn.Get(cs.CONN_IFACE_SIMPLE_PRESENCE, 'Statuses', dbus_interface=dbus.PROPERTIES_IFACE) assert 'available' in statuses assert 'dnd' in statuses assert 'away' in statuses - simple_presence = dbus.Interface(conn, cs.CONN_IFACE_PRESENCE) + simple_presence = dbus.Interface(conn, cs.CONN_IFACE_SIMPLE_PRESENCE) # set your status to away simple_presence.SetPresence('away', 'At the pub') diff --git a/tests/twisted/avahi/text-channel.py b/tests/twisted/avahi/text-channel.py index acaed6a2..b37b1c2f 100644 --- a/tests/twisted/avahi/text-channel.py +++ b/tests/twisted/avahi/text-channel.py @@ -34,9 +34,7 @@ def test(q, bus, conn): cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT, cs.TARGET_HANDLE: handle})[0] text_channel = make_channel_proxy(conn, t, "Channel.Type.Text") - text_channel.SendMessage([{'message-type': cs.MT_NORMAL}, - {'content-type': 'text/plain', - 'content': INCOMING_MESSAGE}], 0) + text_channel.Send(cs.MT_NORMAL, INCOMING_MESSAGE) e = q.expect('incoming-connection', listener = listener) incoming = e.connection @@ -78,12 +76,11 @@ def test(q, bus, conn): e.connection.send(message) - e = q.expect('dbus-signal', signal='MessageReceived') - assert len(e.args[0]) == 2 - assert e.args[0][0]['message-sender-id'] == contact_name - assert e.args[0][0]['message-sender'] == handle - assert e.args[0][0]['message-type'] == cs.MT_NORMAL - assert e.args[0][1]['content'] == OUTGOING_MESSAGE + e = q.expect('dbus-signal', signal='Received') + assert e.args[2] == handle + assert e.args[3] == cs.MT_NORMAL + assert e.args[5] == OUTGOING_MESSAGE + if __name__ == '__main__': exec_test(test) diff --git a/tests/twisted/avahi/tubes/request-muc-tubes.py b/tests/twisted/avahi/tubes/request-muc-tubes.py index 206f3384..21100f15 100644 --- a/tests/twisted/avahi/tubes/request-muc-tubes.py +++ b/tests/twisted/avahi/tubes/request-muc-tubes.py @@ -8,7 +8,7 @@ import avahitest from twisted.words.xish import domish -from saluttest import exec_test +from saluttest import exec_test, wait_for_contact_list from servicetest import call_async, EventPattern, wrap_channel, pretty import constants as cs @@ -19,6 +19,10 @@ def test(q, bus, conn): q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L]) + # FIXME: this is a hack to be sure to have all the contact list channels + # announced so they won't interfere with the muc ones announces. + wait_for_contact_list(q, conn) + # check if we can request tube channels properties = conn.Properties.GetAll(cs.CONN_IFACE_REQUESTS) assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE, diff --git a/tests/twisted/avahi/tubes/tubetestutil.py b/tests/twisted/avahi/tubes/tubetestutil.py index 4e342f9e..d058ef62 100644 --- a/tests/twisted/avahi/tubes/tubetestutil.py +++ b/tests/twisted/avahi/tubes/tubetestutil.py @@ -1,4 +1,4 @@ -from saluttest import make_connection +from saluttest import make_connection, wait_for_contact_list from avahitest import get_host_name from servicetest import make_channel_proxy @@ -10,6 +10,10 @@ def connect_two_accounts(q, bus, conn): conn.Connect() q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED]) + # FIXME: this is a hack to be sure to have all the contact list channels + # announced so they won't interfere with other channels announces. + wait_for_contact_list(q, conn) + # second connection: connect conn2_params = { 'published-name': 'testsuite2', @@ -21,6 +25,8 @@ def connect_two_accounts(q, bus, conn): conn2.Connect() q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTED, cs.CSR_NONE_SPECIFIED]) + wait_for_contact_list(q, conn2) + # first connection: get the contact list publish_handle = conn.RequestHandles(cs.HT_LIST, ["publish"])[0] conn1_publish = conn.RequestChannel(cs.CHANNEL_TYPE_CONTACT_LIST, @@ -56,7 +62,7 @@ def connect_two_accounts(q, bus, conn): # property first contact1_handle_on_conn2 = 0 conn2_members = conn2_publish_proxy.Get( - 'im.telepathy1.Channel.Interface.Group', 'Members', + 'org.freedesktop.Telepathy.Channel.Interface.Group', 'Members', dbus_interface='org.freedesktop.DBus.Properties') for h in conn2_members: name = conn2.InspectHandles(cs.HT_CONTACT, [h])[0] diff --git a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py index ae8864c3..6fc81097 100644 --- a/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py +++ b/tests/twisted/avahi/tubes/two-muc-dbus-tubes.py @@ -21,9 +21,9 @@ def check_dbus_names(tube, members): names = tube.Properties.Get(cs.CHANNEL_TYPE_DBUS_TUBE, 'DBusNames') assert set(names.keys()) == set(members), names.keys() -SERVICE = "im.telepathy1.Tube.Test" +SERVICE = "org.freedesktop.Telepathy.Tube.Test" IFACE = SERVICE -PATH = "/im/telepathy1/Tube/Test" +PATH = "/org/freedesktop/Telepathy/Tube/Test" print "FIXME: MUC tubes tests are currently broken: fdo#69223" # exiting 77 causes automake to consider the test to have been skipped |