[telepathy-gabble/master] update stream tube tests to deal with the debug_msg arg of the ConnectionClosed signal

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Mon May 25 09:30:43 PDT 2009


---
 tests/twisted/tubes/accept-muc-stream-tube.py     |   19 +++++++++++++------
 tests/twisted/tubes/accept-private-stream-tube.py |   16 +++++++++++-----
 tests/twisted/tubes/offer-muc-stream-tube.py      |    6 ++++--
 tests/twisted/tubes/offer-private-stream-tube.py  |    6 ++++--
 4 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/tests/twisted/tubes/accept-muc-stream-tube.py b/tests/twisted/tubes/accept-muc-stream-tube.py
index 68d3a6b..aaa9410 100644
--- a/tests/twisted/tubes/accept-muc-stream-tube.py
+++ b/tests/twisted/tubes/accept-muc-stream-tube.py
@@ -3,7 +3,8 @@
 import dbus
 
 from servicetest import call_async, EventPattern, EventProtocolClientFactory, unwrap
-from gabbletest import make_result_iq, acknowledge_iq, make_muc_presence, send_error_reply
+from gabbletest import make_result_iq, acknowledge_iq, make_muc_presence, send_error_reply,\
+    assertEquals
 import constants as cs
 import ns
 import tubetestutil as t
@@ -230,7 +231,9 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # peer closes the bytestream
     bytestream.close()
-    q.expect('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_LOST])
+    e = q.expect('dbus-signal', signal='ConnectionClosed')
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_LOST)
 
     # establish another tube connection
     socket_event, si_event, conn_id = t.connect_to_cm_socket(q, 'chat at conf.localhost/bob',
@@ -238,9 +241,11 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # bytestream is refused
     send_error_reply(stream, si_event.stanza)
-    q.expect_many(
-        EventPattern('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_REFUSED]),
+    e, _ = q.expect_many(
+        EventPattern('dbus-signal', signal='ConnectionClosed'),
         EventPattern('socket-disconnected'))
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_REFUSED)
 
     # establish another tube connection
     socket_event, si_event, conn_id = t.connect_to_cm_socket(q, 'chat at conf.localhost/bob',
@@ -251,9 +256,11 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # disconnect local socket
     protocol.transport.loseConnection()
-    q.expect_many(
-        EventPattern('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CANCELLED]),
+    e, _ = q.expect_many(
+        EventPattern('dbus-signal', signal='ConnectionClosed'),
         EventPattern('socket-disconnected'))
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CANCELLED)
 
     # OK, we're done
     conn.Disconnect()
diff --git a/tests/twisted/tubes/accept-private-stream-tube.py b/tests/twisted/tubes/accept-private-stream-tube.py
index f2b3403..fe21db7 100644
--- a/tests/twisted/tubes/accept-private-stream-tube.py
+++ b/tests/twisted/tubes/accept-private-stream-tube.py
@@ -11,7 +11,7 @@ Receives several tube offers:
 import dbus
 
 from servicetest import call_async, EventPattern, sync_dbus
-from gabbletest import acknowledge_iq, send_error_reply
+from gabbletest import acknowledge_iq, send_error_reply, assertEquals
 
 from twisted.words.xish import domish, xpath
 from twisted.internet import reactor
@@ -233,9 +233,11 @@ def test(q, bus, conn, stream, bytestream_cls,
     bytestream, conn_id = expect_tube_activity(q, bus, conn, stream, bytestream_cls,
         address_type, socket_address, access_control, access_control_param)
     tubes_chan.Close()
-    bytestream.wait_bytestream_closed([
-        EventPattern('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CANCELLED]),
+    e, _ = bytestream.wait_bytestream_closed([
+        EventPattern('dbus-signal', signal='ConnectionClosed'),
         EventPattern('socket-disconnected')])
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CANCELLED)
 
     # Receive a tube offer from Bob
     (tubes_chan, tubes_iface, new_tube_chan, new_tube_iface) = \
@@ -257,7 +259,9 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # peer closes the bytestream
     bytestream.close()
-    q.expect('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_LOST])
+    e = q.expect('dbus-signal', signal='ConnectionClosed')
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_LOST)
 
     # establish another tube connection
     event_socket, si_event, conn_id = t.connect_to_cm_socket(q, bob_jid,
@@ -265,7 +269,9 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # bytestream is refused
     send_error_reply(stream, si_event.stanza)
-    e = q.expect('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_REFUSED])
+    e = q.expect('dbus-signal', signal='ConnectionClosed')
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_REFUSED)
 
     tubes_chan.Close()
 
diff --git a/tests/twisted/tubes/offer-muc-stream-tube.py b/tests/twisted/tubes/offer-muc-stream-tube.py
index f109698..600afb2 100644
--- a/tests/twisted/tubes/offer-muc-stream-tube.py
+++ b/tests/twisted/tubes/offer-muc-stream-tube.py
@@ -7,7 +7,7 @@ import dbus
 
 from servicetest import call_async, EventPattern, unwrap,\
     assertContains
-from gabbletest import acknowledge_iq, make_muc_presence
+from gabbletest import acknowledge_iq, make_muc_presence, assertEquals
 import constants as cs
 import ns
 import tubetestutil as t
@@ -57,7 +57,9 @@ def use_tube(q, bytestream, protocol, conn_id):
 
     # peer closes the bytestream
     bytestream.close()
-    q.expect('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_LOST])
+    e = q.expect('dbus-signal', signal='ConnectionClosed')
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_LOST)
 
 def test(q, bus, conn, stream, bytestream_cls,
        address_type, access_control, access_control_param):
diff --git a/tests/twisted/tubes/offer-private-stream-tube.py b/tests/twisted/tubes/offer-private-stream-tube.py
index 1c41b88..75ebbb6 100644
--- a/tests/twisted/tubes/offer-private-stream-tube.py
+++ b/tests/twisted/tubes/offer-private-stream-tube.py
@@ -3,7 +3,7 @@
 import dbus
 
 from servicetest import call_async, EventPattern, sync_dbus
-from gabbletest import acknowledge_iq, sync_stream
+from gabbletest import acknowledge_iq, sync_stream, assertEquals
 import constants as cs
 import ns
 import tubetestutil as t
@@ -415,7 +415,9 @@ def test(q, bus, conn, stream, bytestream_cls,
 
     # peer closes the bytestream
     bytestream2.close()
-    q.expect('dbus-signal', signal='ConnectionClosed', args=[conn_id, cs.CONNECTION_LOST])
+    e = q.expect('dbus-signal', signal='ConnectionClosed')
+    assertEquals(e.args[0], conn_id)
+    assertEquals(e.args[1], cs.CONNECTION_LOST)
 
     # OK, we're done
     conn.Disconnect()
-- 
1.5.6.5




More information about the telepathy-commits mailing list