[telepathy-mission-control/master] tests: create AM proxy with follow_name_owner_changes=True

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Sep 15 09:16:40 PDT 2009


This fixes a race between MC starting up and claiming its bus name, and
the test running.
---
 test/twisted/account-manager/account-basics.py     |    4 ++--
 test/twisted/account-manager/bad-cm.py             |    4 ++--
 .../account-manager/create-with-properties.py      |    4 ++--
 .../account-manager/old-create-with-properties.py  |    4 ++--
 test/twisted/account-manager/param-types.py        |    4 ++--
 test/twisted/mctest.py                             |    4 ++++
 6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/test/twisted/account-manager/account-basics.py b/test/twisted/account-manager/account-basics.py
index 26714cc..901f7fc 100644
--- a/test/twisted/account-manager/account-basics.py
+++ b/test/twisted/account-manager/account-basics.py
@@ -21,12 +21,12 @@ import dbus.service
 
 from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
         call_async
-from mctest import exec_test, create_fakecm_account
+from mctest import exec_test, create_fakecm_account, get_account_manager
 import constants as cs
 
 def test(q, bus, mc):
     # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+    account_manager = get_account_manager(bus)
     account_manager_iface = dbus.Interface(account_manager, cs.AM)
 
     # Introspect AccountManager for debugging purpose
diff --git a/test/twisted/account-manager/bad-cm.py b/test/twisted/account-manager/bad-cm.py
index 943f3f1..dea5860 100644
--- a/test/twisted/account-manager/bad-cm.py
+++ b/test/twisted/account-manager/bad-cm.py
@@ -24,7 +24,7 @@ import dbus
 from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
         call_async
 from fakecm import start_fake_connection_manager
-from mctest import exec_test
+from mctest import exec_test, get_account_manager
 import constants as cs
 
 FakeCM_bus_name = "com.example.FakeCM"
@@ -33,7 +33,7 @@ ConnectionManager_object_path = "/com/example/FakeCM/ConnectionManager"
 
 def test(q, bus, mc):
     # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+    account_manager = get_account_manager(bus)
     account_manager_iface = dbus.Interface(account_manager, cs.AM)
 
     # Create an account with a bad Connection_Manager - it should fail
diff --git a/test/twisted/account-manager/create-with-properties.py b/test/twisted/account-manager/create-with-properties.py
index f6deb4f..a388faf 100644
--- a/test/twisted/account-manager/create-with-properties.py
+++ b/test/twisted/account-manager/create-with-properties.py
@@ -22,12 +22,12 @@ import dbus.service
 
 from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
         call_async
-from mctest import exec_test, create_fakecm_account
+from mctest import exec_test, create_fakecm_account, get_account_manager
 import constants as cs
 
 def test(q, bus, mc):
     # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+    account_manager = get_account_manager(bus)
     account_manager_iface = dbus.Interface(account_manager, cs.AM)
 
     # Introspect AccountManager for debugging purpose
diff --git a/test/twisted/account-manager/old-create-with-properties.py b/test/twisted/account-manager/old-create-with-properties.py
index 38ca537..798d378 100644
--- a/test/twisted/account-manager/old-create-with-properties.py
+++ b/test/twisted/account-manager/old-create-with-properties.py
@@ -22,12 +22,12 @@ import dbus.service
 
 from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
         call_async
-from mctest import exec_test, create_fakecm_account
+from mctest import exec_test, create_fakecm_account, get_account_manager
 import constants as cs
 
 def test(q, bus, mc):
     # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+    account_manager = get_account_manager(bus)
     account_manager_iface = dbus.Interface(account_manager, cs.AM)
 
     # Introspect AccountManager for debugging purpose
diff --git a/test/twisted/account-manager/param-types.py b/test/twisted/account-manager/param-types.py
index b060b06..8dafd7f 100644
--- a/test/twisted/account-manager/param-types.py
+++ b/test/twisted/account-manager/param-types.py
@@ -22,7 +22,7 @@ import dbus.service
 
 from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
         call_async
-from mctest import exec_test, create_fakecm_account
+from mctest import exec_test, create_fakecm_account, get_account_manager
 import constants as cs
 
 def test(q, bus, mc):
@@ -31,7 +31,7 @@ def test(q, bus, mc):
             bus=bus)
 
     # Get the AccountManager interface
-    account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+    account_manager = get_account_manager(bus)
     account_manager_iface = dbus.Interface(account_manager, cs.AM)
 
     params = dbus.Dictionary({
diff --git a/test/twisted/mctest.py b/test/twisted/mctest.py
index 5aa015a..6d06d58 100644
--- a/test/twisted/mctest.py
+++ b/test/twisted/mctest.py
@@ -874,3 +874,7 @@ def expect_client_setup(q, clients, got_interfaces_already=False):
                 path=client.object_path, predicate=is_handler_setup))
 
     q.expect_many(*patterns)
+
+def get_account_manager(bus):
+    return bus.get_object(cs.AM, cs.AM_PATH,
+            follow_name_owner_changes=True)
-- 
1.5.6.5




More information about the telepathy-commits mailing list