summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-22 18:46:39 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-09-28 11:32:19 +0100
commit95a3fdd9a18b638d3e20df0df5976c2bf41c150d (patch)
tree710ac8df17990707ce07145c87772d4cb84a991a /tests
parent8af66a228e79470cde692d3aeaf43e70168f1b86 (diff)
account-manager/create-with-properties: modernize and asyncify
For some reason, the blocking call to Introspect here reliably deadlocked against the blocking call MC will, in a couple of patches' time, make to (the fake) Network Manager service implemented by the test suite. Removing it just made the GetAll() call deadlock instead. If I render that asynchronous, the deadlock goes away. I am not overly happy with having to do this kind of ad-hoc kludging of the test suite to make it run, but we're working around a library bug and I have no interest in delaying the NM integration while I fix nm-glib.
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/account-manager/create-with-properties.py23
1 files changed, 7 insertions, 16 deletions
diff --git a/tests/twisted/account-manager/create-with-properties.py b/tests/twisted/account-manager/create-with-properties.py
index 235853e9..d5e9685e 100644
--- a/tests/twisted/account-manager/create-with-properties.py
+++ b/tests/twisted/account-manager/create-with-properties.py
@@ -22,22 +22,15 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async
-from mctest import exec_test, create_fakecm_account, get_account_manager
+from mctest import exec_test, create_fakecm_account, AccountManager
import constants as cs
def test(q, bus, mc):
- # Get the AccountManager interface
- account_manager = get_account_manager(bus)
- account_manager_iface = dbus.Interface(account_manager, cs.AM)
-
- # Introspect AccountManager for debugging purpose
- account_manager_introspected = account_manager.Introspect(
- dbus_interface=cs.INTROSPECTABLE_IFACE)
- #print account_manager_introspected
+ account_manager = AccountManager(bus)
# Check AccountManager has D-Bus property interface
- properties = account_manager.GetAll(cs.AM,
- dbus_interface=cs.PROPERTIES_IFACE)
+ call_async(q, account_manager.Properties, 'GetAll', cs.AM)
+ properties, = q.expect('dbus-return', method='GetAll').value
assert properties is not None
assert properties.get('ValidAccounts') == [], \
properties.get('ValidAccounts')
@@ -65,8 +58,6 @@ def test(q, bus, mc):
cm_name_ref = dbus.service.BusName(cs.tp_name_prefix +
'.ConnectionManager.fakecm', bus=bus)
- account_manager = bus.get_object(cs.AM, cs.AM_PATH)
- am_iface = dbus.Interface(account_manager, cs.AM)
creation_properties = dbus.Dictionary({
cs.ACCOUNT + '.Enabled': True,
@@ -87,7 +78,7 @@ def test(q, bus, mc):
dbus.Dictionary({ 'has-quad-damage': ':y' }, signature='ss'),
}, signature='sv')
- call_async(q, am_iface, 'CreateAccount',
+ call_async(q, account_manager, 'CreateAccount',
'fakecm',
'fakeprotocol',
'fakeaccount',
@@ -149,7 +140,7 @@ def test(q, bus, mc):
creation_properties2 = creation_properties.copy()
creation_properties2[cs.ACCOUNT + '.NonExistent'] = 'foo'
- call_async(q, am_iface, 'CreateAccount',
+ call_async(q, account_manager, 'CreateAccount',
'fakecm',
'fakeprotocol',
'fakeaccount',
@@ -159,7 +150,7 @@ def test(q, bus, mc):
params2 = params.copy()
params2['fake_param'] = 'foo'
- call_async(q, am_iface, 'CreateAccount',
+ call_async(q, account_manager, 'CreateAccount',
'fakecm',
'fakeprotocol',
'fakeaccount',