summaryrefslogtreecommitdiff
path: root/tests/twisted/mctest.py
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-01-06 17:23:47 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2011-01-10 19:34:01 +0000
commit4c99fea93bcc5a29f642fefad6b32329877117a5 (patch)
treefb2b739543973c43a9b05479612979de2f24137c /tests/twisted/mctest.py
parente90cfdcf5f8991457f631cecef227e0b0ae0af21 (diff)
mctest: tidy up create_fakecm_account()
I think it needs a better docstring: I keep forgetting what it returns. Plus it's full of unnecessary comments and no-op code. So let's tidy it up a bit.
Diffstat (limited to 'tests/twisted/mctest.py')
-rw-r--r--tests/twisted/mctest.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py
index 555a99d9..48170f68 100644
--- a/tests/twisted/mctest.py
+++ b/tests/twisted/mctest.py
@@ -817,20 +817,23 @@ def take_fakecm_name(bus):
def create_fakecm_account(q, bus, mc, params, properties={}):
"""Create a fake connection manager and an account that uses it.
- """
+
+ Optional keyword arguments:
+ properties -- a dictionary from qualified property names to values to pass
+ to CreateAccount. If provided, this function will check that
+ the newly-created account has these properties.
+
+ Returns: (a BusName for the fake CM, an Account proxy)"""
+
cm_name_ref = take_fakecm_name(bus)
account_manager = AccountManager(bus)
- # Create an account
servicetest.call_async(q, account_manager, 'CreateAccount',
- 'fakecm', # Connection_Manager
- 'fakeprotocol', # Protocol
- 'fakeaccount', #Display_Name
- params, properties)
+ 'fakecm', 'fakeprotocol', 'fakeaccount', params, properties)
+
# The spec has no order guarantee here.
# FIXME: MC ought to also introspect the CM and find out that the params
# are in fact sufficient
-
a_signal, am_signal, ret = q.expect_many(
servicetest.EventPattern('dbus-signal',
signal='AccountPropertyChanged', interface=cs.ACCOUNT,
@@ -845,18 +848,12 @@ def create_fakecm_account(q, bus, mc, params, properties={}):
assert account_path is not None
- # Get the Account interface
account = Account(bus, account_path)
for key, value in properties.iteritems():
interface, prop = key.rsplit('.', 1)
servicetest.assertEquals(value, account.Properties.Get(interface, prop))
- # Introspect Account for debugging purpose
- account_introspected = account.Introspect(
- dbus_interface=cs.INTROSPECTABLE_IFACE)
- #print account_introspected
-
return (cm_name_ref, account)
def get_fakecm_account(bus, mc, account_path):