[telepathy-mission-control/telepathy-mission-control-5.2] dispatcher/already-has-*.py: succeed despite early GetInterfaces call

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Sep 3 11:25:37 PDT 2009


These tests make assumptions about the order of method calls in order to
set up unusual situations, so the early call to GetInterfaces made them
deadlock.

Also take the opportunity to exercise the code path in which
GetInterfaces fails before the connection goes CONNECTED, emulating a
telepathy-glib 0.7.35 (or older) CM.
---
 test/twisted/constants.py                       |    1 +
 test/twisted/dispatcher/already-has-channel.py  |    6 ++++++
 test/twisted/dispatcher/already-has-obsolete.py |    5 +++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/test/twisted/constants.py b/test/twisted/constants.py
index 68880c9..f55ea7f 100644
--- a/test/twisted/constants.py
+++ b/test/twisted/constants.py
@@ -103,6 +103,7 @@ NOT_AVAILABLE = ERROR + '.NotAvailable'
 PERMISSION_DENIED = ERROR + '.PermissionDenied'
 CANCELLED = ERROR + '.Cancelled'
 NOT_YOURS = ERROR + '.NotYours'
+DISCONNECTED = ERROR + '.Disconnected'
 
 TUBE_PARAMETERS = CHANNEL_IFACE_TUBE + '.Parameters'
 TUBE_STATE = CHANNEL_IFACE_TUBE + '.State'
diff --git a/test/twisted/dispatcher/already-has-channel.py b/test/twisted/dispatcher/already-has-channel.py
index 0009105..1aff87b 100644
--- a/test/twisted/dispatcher/already-has-channel.py
+++ b/test/twisted/dispatcher/already-has-channel.py
@@ -73,8 +73,14 @@ def test(q, bus, mc):
     conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol', '_',
             'myself', implement_get_interfaces=False)
 
+
     q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
 
+    # this is the pre-Connect one
+    e = q.expect('dbus-method-call', method='GetInterfaces',
+            path=conn.object_path, handled=False)
+    q.dbus_raise(e.message, cs.DISCONNECTED, 'Not connected yet')
+
     q.expect('dbus-method-call', method='Connect',
             path=conn.object_path, handled=True)
     conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CONN_STATUS_REASON_NONE)
diff --git a/test/twisted/dispatcher/already-has-obsolete.py b/test/twisted/dispatcher/already-has-obsolete.py
index 0ec580c..8aed5bd 100644
--- a/test/twisted/dispatcher/already-has-obsolete.py
+++ b/test/twisted/dispatcher/already-has-obsolete.py
@@ -75,6 +75,11 @@ def test(q, bus, mc):
 
     q.dbus_return(e.message, conn.bus_name, conn.object_path, signature='so')
 
+    # this is the pre-Connect one
+    e = q.expect('dbus-method-call', method='GetInterfaces',
+            path=conn.object_path, handled=False)
+    q.dbus_raise(e.message, cs.DISCONNECTED, 'Not connected yet')
+
     q.expect('dbus-method-call', method='Connect',
             path=conn.object_path, handled=True)
     conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CONN_STATUS_REASON_NONE)
-- 
1.5.6.5




More information about the telepathy-commits mailing list