diff options
Diffstat (limited to 'tests/twisted/avahi/tubes/two-muc-stream-tubes.py')
-rw-r--r-- | tests/twisted/avahi/tubes/two-muc-stream-tubes.py | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/tests/twisted/avahi/tubes/two-muc-stream-tubes.py b/tests/twisted/avahi/tubes/two-muc-stream-tubes.py index 2c2b4b83..50913668 100644 --- a/tests/twisted/avahi/tubes/two-muc-stream-tubes.py +++ b/tests/twisted/avahi/tubes/two-muc-stream-tubes.py @@ -74,119 +74,6 @@ def test(q, bus, conn): conn1_self_handle = conn.GetSelfHandle() - # first connection: join muc - muc_handle1, group1 = t.join_muc(q, conn, muc_name) - - t.invite_to_muc(q, group1, conn2, contact2_handle_on_conn1, contact1_handle_on_conn2) - - # first connection: offer a muc stream tube (old API) - tubes1_path = conn.RequestChannel(CHANNEL_TYPE_TUBES, HT_ROOM, muc_handle1, - True) - contact1_tubes = wrap_channel( - bus.get_object(conn.bus_name, tubes1_path), - 'Tubes') - - q.expect('dbus-signal', signal='NewChannel', - args=[tubes1_path, CHANNEL_TYPE_TUBES, HT_ROOM, muc_handle1, True]) - - conn1_tube_id = contact1_tubes.Tubes.OfferStreamTube("http", - sample_parameters, SOCKET_ADDRESS_TYPE_UNIX, - dbus.ByteArray(server_socket_address), - SOCKET_ACCESS_CONTROL_LOCALHOST, "") - - e = q.expect('dbus-signal', signal='NewTube', path=tubes1_path) - tube = e.args - assert tube[1] == conn1_self_handle # initiator - assert tube[2] == 1 # type = stream tube - assert tube[3] == 'http' # service - assert tube[4] == sample_parameters # paramaters - assert tube[5] == TUBE_CHANNEL_STATE_OPEN - - contact2_channeltype = None - while contact2_channeltype == None: - e = q.expect('dbus-signal', signal='NewChannel') - if (e.args[1] == CHANNEL_TYPE_TUBES) and \ - (e.path.endswith("testsuite2") == True): - tubes2_path = e.args[0] - contact2_channeltype = e.args[1] - - contact2_tubes = wrap_channel( - bus.get_object(conn2.bus_name, tubes2_path), - 'Tubes') - - contact2_tubes_list = contact2_tubes.Tubes.ListTubes() - assert len(contact2_tubes_list) == 1 - contact2_tube = contact2_tubes_list[0] - assert contact2_tube[0] is not None # tube id - conn2_tube_id = contact2_tube[0] - assert contact2_tube[1] is not None # initiator - assert contact2_tube[2] == 1 # type = stream tube - assert contact2_tube[3] == 'http' # service = http - assert contact2_tube[4] is not None # parameters - assert contact2_tube[5] == 0, contact2_tube[5] # status = local pending - - # second connection: accept the tube (old API) - unix_socket_adr = contact2_tubes.Tubes.AcceptStreamTube( - contact2_tube[0], 0, 0, '', byte_arrays=True) - - e = q.expect('dbus-signal', signal='TubeStateChanged', path=tubes2_path) - id, state = e.args - assert id == conn2_tube_id - assert state == TUBE_CHANNEL_STATE_OPEN - - client = ClientCreator(reactor, ClientGreeter) - client.connectUNIX(unix_socket_adr).addCallback(client_connected_cb) - - # server got the connection - _, e = q.expect_many( - EventPattern('server-connected'), - EventPattern('client-connected')) - - client_transport = e.transport - - sig, e = q.expect_many( - EventPattern('dbus-signal', signal='StreamTubeNewConnection', - path=tubes1_path), - EventPattern('client-data-received')) - - id, handle = sig.args - assert id == conn1_tube_id - assert handle == contact2_handle_on_conn1 - - # client receives server's welcome message - assert e.data == SERVER_WELCOME_MSG - - client_transport.write(test_string) - - server_received, client_received = q.expect_many( - EventPattern('server-data-received'), - EventPattern('client-data-received')) - - assert server_received.data == test_string - assert client_received.data == string.swapcase(test_string) - - # contact1 closes the tube - contact1_tubes.Close(conn1_tube_id) - q.expect('dbus-signal', signal='TubeClosed', args=[conn1_tube_id]) - - # contact2 closes the tube - contact2_tubes.Tubes.CloseTube(conn2_tube_id) - q.expect('dbus-signal', signal='TubeClosed', args=[conn2_tube_id]) - - # Now contact1 will create a new muc stream tube to another room using the - # new API - - server_socket_address = listen_for_connections() - - # Can we request muc stream tubes? - properties = conn.Properties.GetAll(CONN_IFACE_REQUESTS) - - assert ({CHANNEL_TYPE: CHANNEL_TYPE_STREAM_TUBE, - TARGET_HANDLE_TYPE: HT_ROOM}, - [TARGET_HANDLE, TARGET_ID, STREAM_TUBE_SERVICE] - ) in properties.get('RequestableChannelClasses'),\ - properties['RequestableChannelClasses'] - # request a stream tube channel (new API) conn.Requests.CreateChannel({ CHANNEL_TYPE: CHANNEL_TYPE_STREAM_TUBE, |