[telepathy-mission-control/master] account-manager/make-valid.py: remove race between SetPresence and AccountPropertiesChanged

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Oct 1 11:56:33 PDT 2009


---
 test/twisted/account-manager/make-valid.py |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/twisted/account-manager/make-valid.py b/test/twisted/account-manager/make-valid.py
index 7da7902..17d5804 100644
--- a/test/twisted/account-manager/make-valid.py
+++ b/test/twisted/account-manager/make-valid.py
@@ -168,14 +168,15 @@ def test(q, bus, unused):
             path=conn.object_path, handled=True, interface=cs.CONN)
     conn.StatusChanged(cs.CONN_STATUS_CONNECTED, cs.CONN_STATUS_REASON_NONE)
 
-    set_presence = q.expect('dbus-method-call', path=conn.object_path,
-            interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
-            handled=True)
-
-    e = q.expect('dbus-signal', signal='AccountPropertyChanged',
-            path=account_path, interface=cs.ACCOUNT,
-            predicate=lambda e: 'CurrentPresence' in e.args[0]
-                and e.args[0]['CurrentPresence'][2] != '')
+    set_presence, e = q.expect_many(
+            EventPattern('dbus-method-call', path=conn.object_path,
+                interface=cs.CONN_IFACE_SIMPLE_PRESENCE, method='SetPresence',
+                handled=True),
+            EventPattern('dbus-signal', signal='AccountPropertyChanged',
+                path=account_path, interface=cs.ACCOUNT,
+                predicate=lambda e: 'CurrentPresence' in e.args[0]
+                    and e.args[0]['CurrentPresence'][2] != ''),
+            )
 
     assert e.args[0]['CurrentPresence'] == (cs.PRESENCE_TYPE_AVAILABLE,
             'available', 'My vision is augmented')
-- 
1.5.6.5



More information about the telepathy-commits mailing list