summaryrefslogtreecommitdiff
path: root/tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py')
-rw-r--r--tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py83
1 files changed, 3 insertions, 80 deletions
diff --git a/tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py b/tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py
index bd064d36..3553d809 100644
--- a/tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py
+++ b/tests/twisted/avahi/tubes/test-two-muc-stream-tubes.py
@@ -14,6 +14,7 @@ from twisted.words.xish import xpath, domish
from twisted.internet.protocol import Factory, Protocol, ClientCreator
from twisted.internet import reactor
from constants import *
+import tubetestutil as t
sample_parameters = dbus.Dictionary({
's': 'hello',
@@ -67,86 +68,8 @@ def test(q, bus, conn):
raise
l = reactor.listenUNIX(server_socket_address, factory)
- # first connection: connect
- contact1_name = "testsuite" + "@" + get_host_name()
- conn.Connect()
- 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)
-
- # second connection: connect
- conn2_params = {
- 'published-name': 'testsuite2',
- 'first-name': 'test2',
- 'last-name': 'suite2',
- }
- contact2_name = "testsuite2" + "@" + get_host_name()
- conn2 = make_connection(bus, lambda x: None, conn2_params)
- conn2.Connect()
- 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.
- # publish
- q.expect('dbus-signal', signal='NewChannel', path=conn2.object_path)
- # subscribe
- q.expect('dbus-signal', signal='NewChannel', path=conn2.object_path)
- # known
- q.expect('dbus-signal', signal='NewChannel', path=conn2.object_path)
-
- # first connection: get the contact list
- publish_handle = conn.RequestHandles(HT_LIST, ["publish"])[0]
- conn1_publish = conn.RequestChannel(
- "org.freedesktop.Telepathy.Channel.Type.ContactList",
- HT_LIST, publish_handle, False)
- conn1_publish_proxy = bus.get_object(conn.bus_name, conn1_publish)
-
- # second connection: get the contact list
- publish_handle = conn2.RequestHandles(HT_LIST, ["publish"])[0]
- conn2_publish = conn2.RequestChannel(
- "org.freedesktop.Telepathy.Channel.Type.ContactList",
- HT_LIST, publish_handle, False)
- conn2_publish_proxy = bus.get_object(conn2.bus_name, conn2_publish)
-
- # first connection: wait to see contact2
- # The signal MembersChanged may be already emitted... check the Members
- # property first
- contact2_handle_on_conn1 = 0
- conn1_members = conn1_publish_proxy.Get(
- 'org.freedesktop.Telepathy.Channel.Interface.Group', 'Members',
- dbus_interface='org.freedesktop.DBus.Properties')
- for h in conn1_members:
- name = conn.InspectHandles(HT_CONTACT, [h])[0]
- if name == contact2_name:
- contact2_handle_on_conn1 = h
- while contact2_handle_on_conn1 == 0:
- e = q.expect('dbus-signal', signal='MembersChanged',
- path=conn1_publish)
- for h in e.args[1]:
- name = conn.InspectHandles(HT_CONTACT, [h])[0]
- if name == contact2_name:
- contact2_handle_on_conn1 = h
-
- # second connection: wait to see contact1
- # The signal MembersChanged may be already emitted... check the Members
- # property first
- contact1_handle_on_conn2 = 0
- conn2_members = conn2_publish_proxy.Get(
- 'org.freedesktop.Telepathy.Channel.Interface.Group', 'Members',
- dbus_interface='org.freedesktop.DBus.Properties')
- for h in conn2_members:
- name = conn2.InspectHandles(HT_CONTACT, [h])[0]
- if name == contact1_name:
- contact1_handle_on_conn2 = h
- while contact1_handle_on_conn2 == 0:
- e = q.expect('dbus-signal', signal='MembersChanged',
- path=conn2_publish)
- for h in e.args[1]:
- name = conn2.InspectHandles(HT_CONTACT, [h])[0]
- if name == contact1_name:
- contact1_handle_on_conn2 = h
+ contact1_name, conn2, contact2_name, contact2_handle_on_conn1,\
+ contact1_handle_on_conn2 = t.connect_two_accounts(q, bus, conn)
# first connection: join muc
conn1_self_handle = conn.GetSelfHandle()