[telepathy-mission-control/master] Various tests: assert that Finished is emitted when we've actually finished

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 27 15:21:49 PDT 2009


---
 test/twisted/dispatcher/already-has-channel.py     |   14 ++++++--------
 test/twisted/dispatcher/already-has-obsolete.py    |   14 ++++++--------
 test/twisted/dispatcher/bypass-approval.py         |   14 ++++++--------
 test/twisted/dispatcher/capture-bundle.py          |   14 ++++++--------
 .../dispatcher/dispatch-delayed-by-plugin.py       |   10 +++++-----
 test/twisted/dispatcher/dispatch-obsolete.py       |   14 ++++++--------
 test/twisted/dispatcher/dispatch-text.py           |   14 ++++++--------
 test/twisted/dispatcher/exploding-bundles.py       |   14 ++++++--------
 test/twisted/dispatcher/recover-from-disconnect.py |   14 ++++++--------
 9 files changed, 53 insertions(+), 69 deletions(-)

diff --git a/test/twisted/dispatcher/already-has-channel.py b/test/twisted/dispatcher/already-has-channel.py
index 1aff87b..e744425 100644
--- a/test/twisted/dispatcher/already-has-channel.py
+++ b/test/twisted/dispatcher/already-has-channel.py
@@ -209,14 +209,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/already-has-obsolete.py b/test/twisted/dispatcher/already-has-obsolete.py
index 8aed5bd..05dcb11 100644
--- a/test/twisted/dispatcher/already-has-obsolete.py
+++ b/test/twisted/dispatcher/already-has-obsolete.py
@@ -207,14 +207,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/bypass-approval.py b/test/twisted/dispatcher/bypass-approval.py
index 02d2a2c..0655a9a 100644
--- a/test/twisted/dispatcher/bypass-approval.py
+++ b/test/twisted/dispatcher/bypass-approval.py
@@ -167,14 +167,12 @@ def expect_and_exercise_approval(q, bus, chan, channel_properties,
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/capture-bundle.py b/test/twisted/dispatcher/capture-bundle.py
index b4f46e1..de77384 100644
--- a/test/twisted/dispatcher/capture-bundle.py
+++ b/test/twisted/dispatcher/capture-bundle.py
@@ -176,14 +176,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/dispatch-delayed-by-plugin.py b/test/twisted/dispatcher/dispatch-delayed-by-plugin.py
index 52c99aa..24a4709 100644
--- a/test/twisted/dispatcher/dispatch-delayed-by-plugin.py
+++ b/test/twisted/dispatcher/dispatch-delayed-by-plugin.py
@@ -260,11 +260,11 @@ def test(q, bus, mc):
     # Handler accepts the Channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
+    q.expect_many(
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     sync_dbus(bus, q, mc)
 
diff --git a/test/twisted/dispatcher/dispatch-obsolete.py b/test/twisted/dispatcher/dispatch-obsolete.py
index 1de5727..4431631 100644
--- a/test/twisted/dispatcher/dispatch-obsolete.py
+++ b/test/twisted/dispatcher/dispatch-obsolete.py
@@ -177,14 +177,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/dispatch-text.py b/test/twisted/dispatcher/dispatch-text.py
index ee3f6fb..acfabec 100644
--- a/test/twisted/dispatcher/dispatch-text.py
+++ b/test/twisted/dispatcher/dispatch-text.py
@@ -186,14 +186,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, bus=empathy_bus, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/exploding-bundles.py b/test/twisted/dispatcher/exploding-bundles.py
index 74725e0..a62a700 100644
--- a/test/twisted/dispatcher/exploding-bundles.py
+++ b/test/twisted/dispatcher/exploding-bundles.py
@@ -202,14 +202,12 @@ def test(q, bus, mc):
     # Empathy accepts the channels
     q.dbus_return(e.message, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
diff --git a/test/twisted/dispatcher/recover-from-disconnect.py b/test/twisted/dispatcher/recover-from-disconnect.py
index 462734c..2c025ee 100644
--- a/test/twisted/dispatcher/recover-from-disconnect.py
+++ b/test/twisted/dispatcher/recover-from-disconnect.py
@@ -260,14 +260,12 @@ def test_dispatching(q, bus, conn, account, empathy, kopete):
     # Empathy accepts the channels
     q.dbus_return(e.message, bus=empathy_bus, signature='')
 
-    # FIXME: this shouldn't happen until after HandleChannels has succeeded,
-    # but MC currently does this as soon as HandleWith is called (fd.o #21003)
-    #q.expect('dbus-signal', path=cdo_path, signal='Finished')
-    #q.expect('dbus-signal', path=cs.CD_PATH,
-    #    signal='DispatchOperationFinished', args=[cdo_path])
-
-    # HandleWith succeeds
-    q.expect('dbus-return', method='HandleWith')
+    q.expect_many(
+            EventPattern('dbus-return', method='HandleWith'),
+            EventPattern('dbus-signal', interface=cs.CDO, signal='Finished'),
+            EventPattern('dbus-signal', interface=cs.CD_IFACE_OP_LIST,
+                signal='DispatchOperationFinished'),
+            )
 
     # Now there are no more active channel dispatch operations
     assert cd_props.Get(cs.CD_IFACE_OP_LIST, 'DispatchOperations') == []
-- 
1.5.6.5




More information about the telepathy-commits mailing list