[Telepathy-commits] [telepathy-salut/master] test-two-muc-stream-tubes: tube and tubes channels are now announced together

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Mar 11 09:15:33 PDT 2009


---
 tests/twisted/avahi/test-two-muc-stream-tubes.py |   52 +++++++++++----------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/tests/twisted/avahi/test-two-muc-stream-tubes.py b/tests/twisted/avahi/test-two-muc-stream-tubes.py
index 6caac0d..e5826d0 100644
--- a/tests/twisted/avahi/test-two-muc-stream-tubes.py
+++ b/tests/twisted/avahi/test-two-muc-stream-tubes.py
@@ -364,31 +364,33 @@ def test(q, bus, conn):
     # tubes channel is created
     e = q.expect('dbus-signal', signal='NewChannels')
     channels = e.args[0]
-    assert len(channels) == 1
-    path, props = channels[0]
-    assert props[CHANNEL_TYPE] == CHANNEL_TYPE_TUBES
-    assert props[INITIATOR_HANDLE] == contact1_handle_on_conn2
-    assert props[INITIATOR_ID] == contact1_name
-    assert props[INTERFACES] == [CHANNEL_IFACE_GROUP]
-    assert props[REQUESTED] == False
-    assert props[TARGET_ID] == muc2_name
-
-    # tube channel is created
-    e = q.expect('dbus-signal', signal='NewChannels')
-    channels = e.args[0]
-    assert len(channels) == 1
-    path, props = channels[0]
-    assert props[CHANNEL_TYPE] == CHANNEL_TYPE_STREAM_TUBE
-    assert props[INITIATOR_HANDLE] == contact1_handle_on_conn2
-    assert props[INITIATOR_ID] == contact1_name
-    assert props[INTERFACES] == [CHANNEL_IFACE_GROUP, CHANNEL_IFACE_TUBE]
-    assert props[REQUESTED] == False
-    assert props[TARGET_ID] == muc2_name
-
-    contact2_tube = bus.get_object(conn.bus_name, path)
-    contact2_stream_tube = make_channel_proxy(conn, path, "Channel.Type.StreamTube.DRAFT")
-    contact2_tube_channel = make_channel_proxy(conn, path, "Channel")
-    tube2_path = path
+    assert len(channels) == 2
+
+    got_tubes, got_tube = False, False
+    for path, props in channels:
+        if props[CHANNEL_TYPE] == CHANNEL_TYPE_TUBES:
+            got_tubes = True
+            assert props[REQUESTED] == False
+            assert props[INTERFACES] == [CHANNEL_IFACE_GROUP]
+        elif props[CHANNEL_TYPE] == CHANNEL_TYPE_STREAM_TUBE:
+            got_tube = True
+            assert props[REQUESTED] == False
+            assert props[INTERFACES] == [CHANNEL_IFACE_GROUP, CHANNEL_IFACE_TUBE]
+            assert props[STREAM_TUBE_SERVICE] == 'test'
+
+            contact2_tube = bus.get_object(conn.bus_name, path)
+            contact2_stream_tube = make_channel_proxy(conn, path, "Channel.Type.StreamTube.DRAFT")
+            contact2_tube_channel = make_channel_proxy(conn, path, "Channel")
+            tube2_path = path
+        else:
+            assert False
+
+        assert props[INITIATOR_HANDLE] == contact1_handle_on_conn2
+        assert props[INITIATOR_ID] == contact1_name
+        assert props[TARGET_ID] == muc2_name
+
+    assert got_tubes
+    assert got_tube
 
     state = contact2_tube.Get(CHANNEL_IFACE_TUBE, 'State', dbus_interface=PROPERTIES_IFACE)
     assert state == TUBE_CHANNEL_STATE_LOCAL_PENDING
-- 
1.5.6.5




More information about the telepathy-commits mailing list