diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-09-20 11:26:01 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-09-28 11:32:20 +0100 |
commit | dea44b07c708a391a2b6d0935aba1a7789c59f49 (patch) | |
tree | 38d9108d1a869baefb861f23e2d9631fc7ff0d4e /tests | |
parent | b4cd6e18b0d247ff69c3513e9492d885b954de89 (diff) |
mctest: split up enable_fakecm_account()
This patch splits out the second half of enable_fakecm_account(),
starting at the point where it expects a RequestConnection call, into a
new function, expect_fakecm_connection(). enable_fakecm_account() calls
it, so its behaviour does not change. But the connectivity-monitoring
tests will want to expect a call to RequestConnection() and let that
part of the standard check run to completion, so will be able to use the
freshly-split-out function.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/twisted/mctest.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py index 68f01087..cd1a8530 100644 --- a/tests/twisted/mctest.py +++ b/tests/twisted/mctest.py @@ -920,13 +920,15 @@ def get_fakecm_account(bus, mc, account_path): return account -def enable_fakecm_account(q, bus, mc, account, expected_params, - has_requests=True, has_presence=False, has_aliasing=False, - has_avatars=False, avatars_persist=True, - extra_interfaces=[], - requested_presence=(2, 'available', ''), - expect_before_connect=[], expect_after_connect=[], - has_hidden=False): +def enable_fakecm_account(q, bus, mc, account, expected_params, **kwargs): + # I'm too lazy to manually pass all the other kwargs to + # expect_fakecm_connection + try: + requested_presence = kwargs['requested_presence'] + del kwargs['requested_presence'] + except KeyError: + requested_presence = (2, 'available', '') + # Enable the account account.Properties.Set(cs.ACCOUNT, 'Enabled', True) @@ -938,6 +940,14 @@ def enable_fakecm_account(q, bus, mc, account, expected_params, account.Properties.Set(cs.ACCOUNT, 'RequestedPresence', requested_presence) + return expect_fakecm_connection(q, bus, mc, account, expected_params, **kwargs) + +def expect_fakecm_connection(q, bus, mc, account, expected_params, + has_requests=True, has_presence=False, has_aliasing=False, + has_avatars=False, avatars_persist=True, + extra_interfaces=[], + expect_before_connect=[], expect_after_connect=[], + has_hidden=False): e = q.expect('dbus-method-call', method='RequestConnection', args=['fakeprotocol', expected_params], destination=cs.tp_name_prefix + '.ConnectionManager.fakecm', |