summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-15 16:16:14 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-29 11:26:58 +0000
commitafca9423aa40cfcb1c71de822345abbcb43981c5 (patch)
treecb3cb53d3e1744e713de9e84c6b4741ff1363893
parent481874e9adde33413c7ac3f75ebfcd8d52f3e94d (diff)
Regression tests: use a simulated CM instead of just holding the bus name
We'll need this if we want to call IdentifyAccount. Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34640
-rw-r--r--tests/twisted/account-manager/account-basics.py2
-rw-r--r--tests/twisted/account-manager/auto-connect.py9
-rw-r--r--tests/twisted/account-manager/avatar-refresh.py8
-rw-r--r--tests/twisted/account-manager/avatar.py2
-rw-r--r--tests/twisted/account-manager/connectivity.py2
-rw-r--r--tests/twisted/account-manager/crashy-cm.py4
-rw-r--r--tests/twisted/account-manager/create-auto-connect.py2
-rw-r--r--tests/twisted/account-manager/create-twice.py5
-rw-r--r--tests/twisted/account-manager/create-with-properties.py5
-rw-r--r--tests/twisted/account-manager/device-idle.py2
-rw-r--r--tests/twisted/account-manager/enable-auto-connect.py2
-rw-r--r--tests/twisted/account-manager/enable.py2
-rw-r--r--tests/twisted/account-manager/irc.py2
-rw-r--r--tests/twisted/account-manager/make-valid.py7
-rw-r--r--tests/twisted/account-manager/nickname.py2
-rw-r--r--tests/twisted/account-manager/param-types.py8
-rwxr-xr-xtests/twisted/account-manager/presence.py2
-rw-r--r--tests/twisted/account-manager/reconnect.py5
-rw-r--r--tests/twisted/account-manager/recover-from-disconnect.py2
-rw-r--r--tests/twisted/account-manager/req-conn-fails.py2
-rw-r--r--tests/twisted/account-manager/request-online.py5
-rw-r--r--tests/twisted/account-manager/server-drops-us.py5
-rw-r--r--tests/twisted/account-manager/service.py2
-rw-r--r--tests/twisted/account-manager/update-parameters.py5
-rw-r--r--tests/twisted/account-requests/cancel.py2
-rw-r--r--tests/twisted/account-requests/create-text.py2
-rw-r--r--tests/twisted/account-requests/delete-account-during-request.py2
-rw-r--r--tests/twisted/account-storage/default-keyring-storage.py2
-rw-r--r--tests/twisted/account-storage/diverted-storage.py2
-rwxr-xr-xtests/twisted/account/addressing.py2
-rw-r--r--tests/twisted/capabilities/contact-caps.py2
-rw-r--r--tests/twisted/crash-recovery/crash-recovery.py2
-rw-r--r--tests/twisted/dispatcher/already-has-channel.py2
-rw-r--r--tests/twisted/dispatcher/approver-fails.py2
-rw-r--r--tests/twisted/dispatcher/bypass-approval.py2
-rw-r--r--tests/twisted/dispatcher/bypass-observers.py2
-rw-r--r--tests/twisted/dispatcher/cancel.py2
-rw-r--r--tests/twisted/dispatcher/capture-bundle.py2
-rw-r--r--tests/twisted/dispatcher/cdo-claim.py2
-rw-r--r--tests/twisted/dispatcher/connect-for-request.py2
-rw-r--r--tests/twisted/dispatcher/create-at-startup.py5
-rw-r--r--tests/twisted/dispatcher/create-delayed-by-mini-plugin.py2
-rw-r--r--tests/twisted/dispatcher/create-handler-fails.py2
-rw-r--r--tests/twisted/dispatcher/create-hints.py2
-rw-r--r--tests/twisted/dispatcher/create-no-preferred-handler.py2
-rw-r--r--tests/twisted/dispatcher/create-rejected-by-mini-plugin.py2
-rw-r--r--tests/twisted/dispatcher/create-text.py2
-rw-r--r--tests/twisted/dispatcher/created-behind-our-back.py2
-rw-r--r--tests/twisted/dispatcher/delay-approvers.py2
-rw-r--r--tests/twisted/dispatcher/delay-then-call-handle-with.py2
-rw-r--r--tests/twisted/dispatcher/delay-then-dont-call-approvers.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-activatable.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-before-connected.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-obsolete.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-rejected-by-mini-plugin.py2
-rw-r--r--tests/twisted/dispatcher/dispatch-text.py2
-rw-r--r--tests/twisted/dispatcher/ensure-and-redispatch.py2
-rw-r--r--tests/twisted/dispatcher/ensure-is-approval.py2
-rw-r--r--tests/twisted/dispatcher/ensure-rapidly.py2
-rw-r--r--tests/twisted/dispatcher/exploding-bundles.py2
-rw-r--r--tests/twisted/dispatcher/fdo-21034.py2
-rw-r--r--tests/twisted/dispatcher/handle-channels-fails.py2
-rw-r--r--tests/twisted/dispatcher/lose-text.py2
-rw-r--r--tests/twisted/dispatcher/recover-from-disconnect.py5
-rw-r--r--tests/twisted/dispatcher/redispatch-channels.py2
-rw-r--r--tests/twisted/dispatcher/request-disabled-account.py2
-rw-r--r--tests/twisted/dispatcher/respawn-activatable-observers.py2
-rw-r--r--tests/twisted/dispatcher/respawn-observers.py2
-rw-r--r--tests/twisted/dispatcher/some-delay-approvers.py2
-rw-r--r--tests/twisted/dispatcher/undispatchable.py2
-rw-r--r--tests/twisted/dispatcher/vanishing-client.py2
-rw-r--r--tests/twisted/mctest.py172
73 files changed, 249 insertions, 117 deletions
diff --git a/tests/twisted/account-manager/account-basics.py b/tests/twisted/account-manager/account-basics.py
index cff3a3fb..4e643cc9 100644
--- a/tests/twisted/account-manager/account-basics.py
+++ b/tests/twisted/account-manager/account-basics.py
@@ -46,7 +46,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_path = account.__dbus_object_path__
diff --git a/tests/twisted/account-manager/auto-connect.py b/tests/twisted/account-manager/auto-connect.py
index c8b9184e..46b13364 100644
--- a/tests/twisted/account-manager/auto-connect.py
+++ b/tests/twisted/account-manager/auto-connect.py
@@ -27,16 +27,13 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async, assertEquals
-from mctest import exec_test, SimulatedConnection, create_fakecm_account, MC
+from mctest import (exec_test, SimulatedConnection,
+ SimulatedConnectionManager, MC)
import constants as cs
-cm_name_ref = dbus.service.BusName(
- cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=dbus.SessionBus())
-
account_id = 'fakecm/fakeprotocol/jc_2edenton_40unatco_2eint'
def preseed(q, bus, fake_accounts_service):
-
accounts_dir = os.environ['MC_ACCOUNT_DIR']
try:
@@ -78,6 +75,8 @@ def preseed(q, bus, fake_accounts_service):
account_connections_file.close()
def test(q, bus, unused, **kwargs):
+ simulated_cm = SimulatedConnectionManager(q, bus)
+
fake_accounts_service = kwargs['fake_accounts_service']
preseed(q, bus, fake_accounts_service)
diff --git a/tests/twisted/account-manager/avatar-refresh.py b/tests/twisted/account-manager/avatar-refresh.py
index e1c7051f..f76d7fb6 100644
--- a/tests/twisted/account-manager/avatar-refresh.py
+++ b/tests/twisted/account-manager/avatar-refresh.py
@@ -28,12 +28,10 @@ import dbus.service
from servicetest import (EventPattern, tp_name_prefix, tp_path_prefix,
call_async, assertEquals, sync_dbus)
-from mctest import exec_test, SimulatedConnection, create_fakecm_account, MC
+from mctest import (exec_test, SimulatedConnection,
+ SimulatedConnectionManager, MC)
import constants as cs
-cm_name_ref = dbus.service.BusName(
- cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=dbus.SessionBus())
-
class Account(object):
def __init__(self, fake_accounts_service, accounts_dir,
avatars_persist, server_delays, local_avatar, remote_avatar):
@@ -357,6 +355,8 @@ def preseed(q, bus, fake_accounts_service):
return accounts
def test(q, bus, unused, **kwargs):
+ simulated_cm = SimulatedConnectionManager(q, bus)
+
fake_accounts_service = kwargs['fake_accounts_service']
accounts = preseed(q, bus, fake_accounts_service)
diff --git a/tests/twisted/account-manager/avatar.py b/tests/twisted/account-manager/avatar.py
index 9677e8a5..8bae300e 100644
--- a/tests/twisted/account-manager/avatar.py
+++ b/tests/twisted/account-manager/avatar.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "me@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/connectivity.py b/tests/twisted/account-manager/connectivity.py
index 95fac29d..1e378dc4 100644
--- a/tests/twisted/account-manager/connectivity.py
+++ b/tests/twisted/account-manager/connectivity.py
@@ -46,7 +46,7 @@ def test(q, bus, mc):
{"account": "yum yum network manager",
"password": "boo boo connman (although your API *is* simpler)",
}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
# While we're not connected to the internet, RequestConnection should not
# be called.
diff --git a/tests/twisted/account-manager/crashy-cm.py b/tests/twisted/account-manager/crashy-cm.py
index 531c41a8..ca8f0ae5 100644
--- a/tests/twisted/account-manager/crashy-cm.py
+++ b/tests/twisted/account-manager/crashy-cm.py
@@ -38,7 +38,7 @@ def test(q, bus, mc):
{"account": "someguy@example.com",
"password": "secrecy",
}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params,
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params,
cm_bus=cm_bus)
account.Properties.Set(cs.ACCOUNT, 'Enabled', True)
@@ -69,7 +69,7 @@ def test(q, bus, mc):
# CM crashes
conn.release_name()
- del cm_name_ref
+ simulated_cm.release_name()
cm_bus.flush()
cm_bus.close()
diff --git a/tests/twisted/account-manager/create-auto-connect.py b/tests/twisted/account-manager/create-auto-connect.py
index 54acc27e..45acda05 100644
--- a/tests/twisted/account-manager/create-auto-connect.py
+++ b/tests/twisted/account-manager/create-auto-connect.py
@@ -28,7 +28,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "smcv@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/create-twice.py b/tests/twisted/account-manager/create-twice.py
index 2f0c0e0c..3f1b8e20 100644
--- a/tests/twisted/account-manager/create-twice.py
+++ b/tests/twisted/account-manager/create-twice.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, get_account_manager
+from mctest import exec_test, SimulatedConnectionManager, get_account_manager
import constants as cs
def test(q, bus, mc):
@@ -35,8 +35,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "create-twice",
"password": "secrecy"}, signature='sv')
- cm_name_ref = dbus.service.BusName(cs.tp_name_prefix +
- '.ConnectionManager.fakecm', bus=bus)
+ simulated_cm = SimulatedConnectionManager(q, bus)
account_manager = bus.get_object(cs.AM, cs.AM_PATH)
am_iface = dbus.Interface(account_manager, cs.AM)
diff --git a/tests/twisted/account-manager/create-with-properties.py b/tests/twisted/account-manager/create-with-properties.py
index 128ac942..8d02e2d5 100644
--- a/tests/twisted/account-manager/create-with-properties.py
+++ b/tests/twisted/account-manager/create-with-properties.py
@@ -22,7 +22,7 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async, assertEquals, assertContains
-from mctest import exec_test, create_fakecm_account, AccountManager
+from mctest import (exec_test, SimulatedConnectionManager, AccountManager)
import constants as cs
def test(q, bus, mc):
@@ -53,8 +53,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "anarki@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref = dbus.service.BusName(cs.tp_name_prefix +
- '.ConnectionManager.fakecm', bus=bus)
+ simulated_cm = SimulatedConnectionManager(q, bus)
creation_properties = dbus.Dictionary({
cs.ACCOUNT + '.Enabled': True,
diff --git a/tests/twisted/account-manager/device-idle.py b/tests/twisted/account-manager/device-idle.py
index 434544a9..dcc76ec9 100644
--- a/tests/twisted/account-manager/device-idle.py
+++ b/tests/twisted/account-manager/device-idle.py
@@ -82,7 +82,7 @@ def _create_and_enable(q, bus, mc, account_name, power_saving_supported,
extra_interfaces = [cs.CONN_IFACE_POWER_SAVING]
params = dbus.Dictionary({"account": account_name, "password": "secrecy"},
signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params,
extra_interfaces=extra_interfaces,
expect_after_connect=expect_after_connect)
diff --git a/tests/twisted/account-manager/enable-auto-connect.py b/tests/twisted/account-manager/enable-auto-connect.py
index c5f98994..d8ff3aee 100644
--- a/tests/twisted/account-manager/enable-auto-connect.py
+++ b/tests/twisted/account-manager/enable-auto-connect.py
@@ -28,7 +28,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "smcv@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/enable.py b/tests/twisted/account-manager/enable.py
index 14525ff3..db659f3b 100644
--- a/tests/twisted/account-manager/enable.py
+++ b/tests/twisted/account-manager/enable.py
@@ -28,7 +28,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "smcv@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/irc.py b/tests/twisted/account-manager/irc.py
index 47612bd3..0d0de71f 100644
--- a/tests/twisted/account-manager/irc.py
+++ b/tests/twisted/account-manager/irc.py
@@ -32,7 +32,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "brucewayne",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/make-valid.py b/tests/twisted/account-manager/make-valid.py
index 33582c50..6e7ea34e 100644
--- a/tests/twisted/account-manager/make-valid.py
+++ b/tests/twisted/account-manager/make-valid.py
@@ -27,12 +27,10 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async, sync_dbus
-from mctest import exec_test, SimulatedConnection, create_fakecm_account, MC
+from mctest import (exec_test, SimulatedConnection, create_fakecm_account, MC,
+ SimulatedConnectionManager)
import constants as cs
-cm_name_ref = dbus.service.BusName(
- cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=dbus.SessionBus())
-
account1_id = 'fakecm/fakeprotocol/jc_2edenton_40unatco_2eint'
account2_id = 'fakecm/fakeprotocol/jc_2edenton_40example_2ecom'
@@ -95,6 +93,7 @@ def preseed(q, bus, fake_accounts_service):
account_connections_file.close()
def test(q, bus, unused, **kwargs):
+ simulated_cm = SimulatedConnectionManager(q, bus)
# make sure RequestConnection doesn't get called yet
events = [EventPattern('dbus-method-call', method='RequestConnection')]
diff --git a/tests/twisted/account-manager/nickname.py b/tests/twisted/account-manager/nickname.py
index b128942c..e10342d3 100644
--- a/tests/twisted/account-manager/nickname.py
+++ b/tests/twisted/account-manager/nickname.py
@@ -28,7 +28,7 @@ import constants as cs
def test(q, bus, mc, nickname):
params = dbus.Dictionary({"account": "wjt@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/param-types.py b/tests/twisted/account-manager/param-types.py
index 8dafd7f1..68eff808 100644
--- a/tests/twisted/account-manager/param-types.py
+++ b/tests/twisted/account-manager/param-types.py
@@ -22,13 +22,13 @@ 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, get_account_manager,
+ SimulatedConnectionManager)
import constants as cs
def test(q, bus, mc):
- cm_name_ref = dbus.service.BusName(
- cs.tp_name_prefix + '.ConnectionManager.onewitheverything',
- bus=bus)
+ simulated_cm = SimulatedConnectionManager(q, bus,
+ cm_name='onewitheverything', protocol_names=['serializable'])
# Get the AccountManager interface
account_manager = get_account_manager(bus)
diff --git a/tests/twisted/account-manager/presence.py b/tests/twisted/account-manager/presence.py
index 40345937..9f04f675 100755
--- a/tests/twisted/account-manager/presence.py
+++ b/tests/twisted/account-manager/presence.py
@@ -28,7 +28,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "jc.denton@example.com",
"password": "ionstorm"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_BUSY), 'busy',
'Fighting conspiracies'), signature='uss')
diff --git a/tests/twisted/account-manager/reconnect.py b/tests/twisted/account-manager/reconnect.py
index 64a3459c..39624a9c 100644
--- a/tests/twisted/account-manager/reconnect.py
+++ b/tests/twisted/account-manager/reconnect.py
@@ -27,13 +27,10 @@ from mctest import exec_test, SimulatedConnection, create_fakecm_account,\
import constants as cs
def test(q, bus, mc):
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
# Create an account
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
# Events that indicate that Reconnect might have done something
looks_like_reconnection = [
diff --git a/tests/twisted/account-manager/recover-from-disconnect.py b/tests/twisted/account-manager/recover-from-disconnect.py
index 186d13d3..932b4700 100644
--- a/tests/twisted/account-manager/recover-from-disconnect.py
+++ b/tests/twisted/account-manager/recover-from-disconnect.py
@@ -29,7 +29,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy",
"register": True}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
call_async(q, account.Properties, 'Set', cs.ACCOUNT, 'Enabled', False)
q.expect('dbus-return', method='Set')
diff --git a/tests/twisted/account-manager/req-conn-fails.py b/tests/twisted/account-manager/req-conn-fails.py
index 632504e0..b9f05cba 100644
--- a/tests/twisted/account-manager/req-conn-fails.py
+++ b/tests/twisted/account-manager/req-conn-fails.py
@@ -31,7 +31,7 @@ def test(q, bus, mc):
{"account": "someguy@example.com",
"password": "secrecy",
}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account.Properties.Set(cs.ACCOUNT, 'Enabled', True)
diff --git a/tests/twisted/account-manager/request-online.py b/tests/twisted/account-manager/request-online.py
index 94a0b83a..18186843 100644
--- a/tests/twisted/account-manager/request-online.py
+++ b/tests/twisted/account-manager/request-online.py
@@ -30,9 +30,6 @@ from mctest import (
import constants as cs
def test(q, bus, mc):
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
http_fixed_properties = dbus.Dictionary({
cs.CHANNEL + '.TargetHandleType': 1L,
cs.CHANNEL + '.ChannelType': cs.CHANNEL_TYPE_STREAM_TUBE,
@@ -50,7 +47,7 @@ def test(q, bus, mc):
# Create an account
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
# The account is initially valid but disabled, and hence offline
props = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/server-drops-us.py b/tests/twisted/account-manager/server-drops-us.py
index 30ce62aa..9a9d6ca7 100644
--- a/tests/twisted/account-manager/server-drops-us.py
+++ b/tests/twisted/account-manager/server-drops-us.py
@@ -30,11 +30,8 @@ params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
def test(q, bus, mc):
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
# Create an account
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/account-manager/service.py b/tests/twisted/account-manager/service.py
index f7df9903..7bed951a 100644
--- a/tests/twisted/account-manager/service.py
+++ b/tests/twisted/account-manager/service.py
@@ -27,7 +27,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "wjt@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
srv_name = 'fu-bar-42'
account_iface = dbus.Interface(account, cs.ACCOUNT)
diff --git a/tests/twisted/account-manager/update-parameters.py b/tests/twisted/account-manager/update-parameters.py
index 72495321..4fc3d3a0 100644
--- a/tests/twisted/account-manager/update-parameters.py
+++ b/tests/twisted/account-manager/update-parameters.py
@@ -30,16 +30,13 @@ from mctest import exec_test, SimulatedConnection, create_fakecm_account,\
import constants as cs
def test(q, bus, mc, **kwargs):
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
# Create an account
params = dbus.Dictionary(
{"account": "someguy@example.com",
"password": "secrecy",
"nickname": "albinoblacksheep",
}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
# Enable the account
account.Set(cs.ACCOUNT, 'Enabled', True,
diff --git a/tests/twisted/account-requests/cancel.py b/tests/twisted/account-requests/cancel.py
index f236e5b8..9effcbec 100644
--- a/tests/twisted/account-requests/cancel.py
+++ b/tests/twisted/account-requests/cancel.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/account-requests/create-text.py b/tests/twisted/account-requests/create-text.py
index e71aca9d..c6d5922e 100644
--- a/tests/twisted/account-requests/create-text.py
+++ b/tests/twisted/account-requests/create-text.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/account-requests/delete-account-during-request.py b/tests/twisted/account-requests/delete-account-during-request.py
index 348c45a7..0b448eb8 100644
--- a/tests/twisted/account-requests/delete-account-during-request.py
+++ b/tests/twisted/account-requests/delete-account-during-request.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/account-storage/default-keyring-storage.py b/tests/twisted/account-storage/default-keyring-storage.py
index 2d3b2fcf..a7857187 100644
--- a/tests/twisted/account-storage/default-keyring-storage.py
+++ b/tests/twisted/account-storage/default-keyring-storage.py
@@ -74,7 +74,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "dontdivert@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_path = account.__dbus_object_path__
diff --git a/tests/twisted/account-storage/diverted-storage.py b/tests/twisted/account-storage/diverted-storage.py
index 8692b09b..2346b853 100644
--- a/tests/twisted/account-storage/diverted-storage.py
+++ b/tests/twisted/account-storage/diverted-storage.py
@@ -53,7 +53,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_path = account.__dbus_object_path__
diff --git a/tests/twisted/account/addressing.py b/tests/twisted/account/addressing.py
index e303c935..222546b0 100755
--- a/tests/twisted/account/addressing.py
+++ b/tests/twisted/account/addressing.py
@@ -31,7 +31,7 @@ def test(q, bus, mc):
params = dbus.Dictionary ({"account": "jc.denton@example.com",
"password": "ionstorm"},
signature='sv')
- (cm_name_ref, account) = create_fakecm_account (q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account (q, bus, mc, params)
account_iface = dbus.Interface (account, cs.ACCOUNT)
account_props = dbus.Interface (account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/capabilities/contact-caps.py b/tests/twisted/capabilities/contact-caps.py
index 72fddcf2..320a8c5e 100644
--- a/tests/twisted/capabilities/contact-caps.py
+++ b/tests/twisted/capabilities/contact-caps.py
@@ -97,7 +97,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn, before = enable_fakecm_account(q, bus, mc, account, params,
extra_interfaces=[cs.CONN_IFACE_CONTACT_CAPS],
expect_before_connect=[
diff --git a/tests/twisted/crash-recovery/crash-recovery.py b/tests/twisted/crash-recovery/crash-recovery.py
index 2bc45349..1656ab12 100644
--- a/tests/twisted/crash-recovery/crash-recovery.py
+++ b/tests/twisted/crash-recovery/crash-recovery.py
@@ -27,7 +27,7 @@ import dbus.service
from servicetest import EventPattern, call_async
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
- create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
+ SimulatedChannel, \
expect_client_setup, MC
import constants as cs
diff --git a/tests/twisted/dispatcher/already-has-channel.py b/tests/twisted/dispatcher/already-has-channel.py
index 9c033af7..6b666e12 100644
--- a/tests/twisted/dispatcher/already-has-channel.py
+++ b/tests/twisted/dispatcher/already-has-channel.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
text_fixed_properties = dbus.Dictionary({
cs.CHANNEL + '.TargetHandleType': cs.HT_CONTACT,
diff --git a/tests/twisted/dispatcher/approver-fails.py b/tests/twisted/dispatcher/approver-fails.py
index 67ce36a3..b8705bb7 100644
--- a/tests/twisted/dispatcher/approver-fails.py
+++ b/tests/twisted/dispatcher/approver-fails.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/bypass-approval.py b/tests/twisted/dispatcher/bypass-approval.py
index 0655a9a9..eddb3155 100644
--- a/tests/twisted/dispatcher/bypass-approval.py
+++ b/tests/twisted/dispatcher/bypass-approval.py
@@ -181,7 +181,7 @@ def expect_and_exercise_approval(q, bus, chan, channel_properties,
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
# Two clients want to observe, approve and handle channels. Additionally,
diff --git a/tests/twisted/dispatcher/bypass-observers.py b/tests/twisted/dispatcher/bypass-observers.py
index d8b02660..1aeb318f 100644
--- a/tests/twisted/dispatcher/bypass-observers.py
+++ b/tests/twisted/dispatcher/bypass-observers.py
@@ -182,7 +182,7 @@ def expect_and_exercise_approval(q, bus, chan, channel_properties,
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
# Two clients want to observe, approve and handle channels. Additionally,
diff --git a/tests/twisted/dispatcher/cancel.py b/tests/twisted/dispatcher/cancel.py
index 5b8d90af..fe23f005 100644
--- a/tests/twisted/dispatcher/cancel.py
+++ b/tests/twisted/dispatcher/cancel.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/capture-bundle.py b/tests/twisted/dispatcher/capture-bundle.py
index 6b75d83a..44e18e87 100644
--- a/tests/twisted/dispatcher/capture-bundle.py
+++ b/tests/twisted/dispatcher/capture-bundle.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/cdo-claim.py b/tests/twisted/dispatcher/cdo-claim.py
index ec98b93f..89474f9b 100644
--- a/tests/twisted/dispatcher/cdo-claim.py
+++ b/tests/twisted/dispatcher/cdo-claim.py
@@ -30,7 +30,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/connect-for-request.py b/tests/twisted/dispatcher/connect-for-request.py
index 1163752c..034cd054 100644
--- a/tests/twisted/dispatcher/connect-for-request.py
+++ b/tests/twisted/dispatcher/connect-for-request.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "smcv@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/dispatcher/create-at-startup.py b/tests/twisted/dispatcher/create-at-startup.py
index 7537faaf..fb515723 100644
--- a/tests/twisted/dispatcher/create-at-startup.py
+++ b/tests/twisted/dispatcher/create-at-startup.py
@@ -28,7 +28,7 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async
from mctest import exec_test, SimulatedConnection, SimulatedClient, \
- create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
+ SimulatedConnectionManager, SimulatedChannel, \
expect_client_setup, MC
import constants as cs
@@ -76,8 +76,7 @@ def test(q, bus, unused, **kwargs):
observe=[text_fixed_properties], approve=[text_fixed_properties],
handle=[text_fixed_properties], bypass_approval=False,
implement_get_interfaces=False)
- cm_name_ref = dbus.service.BusName(
- cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
+ simulated_cm = SimulatedConnectionManager(q, bus)
# service-activate MC; it will try to introspect the running client.
mc = MC(q, bus, wait_for_names=False)
diff --git a/tests/twisted/dispatcher/create-delayed-by-mini-plugin.py b/tests/twisted/dispatcher/create-delayed-by-mini-plugin.py
index 1c7c926a..fcf021b9 100644
--- a/tests/twisted/dispatcher/create-delayed-by-mini-plugin.py
+++ b/tests/twisted/dispatcher/create-delayed-by-mini-plugin.py
@@ -41,7 +41,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn, e = enable_fakecm_account(q, bus, mc, account, params,
extra_interfaces=[cs.CONN_IFACE_SERVICE_POINT],
expect_after_connect=[
diff --git a/tests/twisted/dispatcher/create-handler-fails.py b/tests/twisted/dispatcher/create-handler-fails.py
index ccdae2f9..13523636 100644
--- a/tests/twisted/dispatcher/create-handler-fails.py
+++ b/tests/twisted/dispatcher/create-handler-fails.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/create-hints.py b/tests/twisted/dispatcher/create-hints.py
index daf8cdcd..3b8cf94b 100644
--- a/tests/twisted/dispatcher/create-hints.py
+++ b/tests/twisted/dispatcher/create-hints.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/create-no-preferred-handler.py b/tests/twisted/dispatcher/create-no-preferred-handler.py
index 3e078415..11ac44b5 100644
--- a/tests/twisted/dispatcher/create-no-preferred-handler.py
+++ b/tests/twisted/dispatcher/create-no-preferred-handler.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/create-rejected-by-mini-plugin.py b/tests/twisted/dispatcher/create-rejected-by-mini-plugin.py
index 2f517589..ecd5f6e6 100644
--- a/tests/twisted/dispatcher/create-rejected-by-mini-plugin.py
+++ b/tests/twisted/dispatcher/create-rejected-by-mini-plugin.py
@@ -47,7 +47,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/create-text.py b/tests/twisted/dispatcher/create-text.py
index a09ae988..a0897ba4 100644
--- a/tests/twisted/dispatcher/create-text.py
+++ b/tests/twisted/dispatcher/create-text.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/created-behind-our-back.py b/tests/twisted/dispatcher/created-behind-our-back.py
index 55d1b4b0..d87e69ac 100644
--- a/tests/twisted/dispatcher/created-behind-our-back.py
+++ b/tests/twisted/dispatcher/created-behind-our-back.py
@@ -39,7 +39,7 @@ def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/delay-approvers.py b/tests/twisted/dispatcher/delay-approvers.py
index a627159d..2a7295f8 100644
--- a/tests/twisted/dispatcher/delay-approvers.py
+++ b/tests/twisted/dispatcher/delay-approvers.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/delay-then-call-handle-with.py b/tests/twisted/dispatcher/delay-then-call-handle-with.py
index 2f79b10e..28fdfb3e 100644
--- a/tests/twisted/dispatcher/delay-then-call-handle-with.py
+++ b/tests/twisted/dispatcher/delay-then-call-handle-with.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/delay-then-dont-call-approvers.py b/tests/twisted/dispatcher/delay-then-dont-call-approvers.py
index 90040228..25ebd908 100644
--- a/tests/twisted/dispatcher/delay-then-dont-call-approvers.py
+++ b/tests/twisted/dispatcher/delay-then-dont-call-approvers.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/dispatch-activatable.py b/tests/twisted/dispatcher/dispatch-activatable.py
index cb7b9cb1..6da442b2 100644
--- a/tests/twisted/dispatcher/dispatch-activatable.py
+++ b/tests/twisted/dispatcher/dispatch-activatable.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
abiword_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/dispatch-before-connected.py b/tests/twisted/dispatcher/dispatch-before-connected.py
index 4d8d0db2..1037ef4c 100644
--- a/tests/twisted/dispatcher/dispatch-before-connected.py
+++ b/tests/twisted/dispatcher/dispatch-before-connected.py
@@ -32,7 +32,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someone@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py b/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
index 48da4c14..d2c0855d 100644
--- a/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
+++ b/tests/twisted/dispatcher/dispatch-delayed-by-mini-plugin.py
@@ -99,7 +99,7 @@ def signal_channel_expect_query(q, bus, account, conn, empathy, kopete):
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
policy_bus_name_ref = dbus.service.BusName('com.example.Policy', bus)
diff --git a/tests/twisted/dispatcher/dispatch-obsolete.py b/tests/twisted/dispatcher/dispatch-obsolete.py
index afe5df66..16d76517 100644
--- a/tests/twisted/dispatcher/dispatch-obsolete.py
+++ b/tests/twisted/dispatcher/dispatch-obsolete.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params,
has_requests=False)
diff --git a/tests/twisted/dispatcher/dispatch-rejected-by-mini-plugin.py b/tests/twisted/dispatcher/dispatch-rejected-by-mini-plugin.py
index 893ff146..37a87105 100644
--- a/tests/twisted/dispatcher/dispatch-rejected-by-mini-plugin.py
+++ b/tests/twisted/dispatcher/dispatch-rejected-by-mini-plugin.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/dispatch-text.py b/tests/twisted/dispatcher/dispatch-text.py
index b1f6ce60..689639ca 100644
--- a/tests/twisted/dispatcher/dispatch-text.py
+++ b/tests/twisted/dispatcher/dispatch-text.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/ensure-and-redispatch.py b/tests/twisted/dispatcher/ensure-and-redispatch.py
index 4d526c2e..f5a77a56 100644
--- a/tests/twisted/dispatcher/ensure-and-redispatch.py
+++ b/tests/twisted/dispatcher/ensure-and-redispatch.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/ensure-is-approval.py b/tests/twisted/dispatcher/ensure-is-approval.py
index a2fb0850..63c6f8a7 100644
--- a/tests/twisted/dispatcher/ensure-is-approval.py
+++ b/tests/twisted/dispatcher/ensure-is-approval.py
@@ -35,7 +35,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
# One client (Kopete) has less specific filters than the other (Empathy),
diff --git a/tests/twisted/dispatcher/ensure-rapidly.py b/tests/twisted/dispatcher/ensure-rapidly.py
index a338799b..f90a1f68 100644
--- a/tests/twisted/dispatcher/ensure-rapidly.py
+++ b/tests/twisted/dispatcher/ensure-rapidly.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/exploding-bundles.py b/tests/twisted/dispatcher/exploding-bundles.py
index a8f06c3b..27d1727e 100644
--- a/tests/twisted/dispatcher/exploding-bundles.py
+++ b/tests/twisted/dispatcher/exploding-bundles.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/fdo-21034.py b/tests/twisted/dispatcher/fdo-21034.py
index 5a1ca3ca..e0ed001a 100644
--- a/tests/twisted/dispatcher/fdo-21034.py
+++ b/tests/twisted/dispatcher/fdo-21034.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/handle-channels-fails.py b/tests/twisted/dispatcher/handle-channels-fails.py
index 04b51ef7..4b3ae22e 100644
--- a/tests/twisted/dispatcher/handle-channels-fails.py
+++ b/tests/twisted/dispatcher/handle-channels-fails.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/lose-text.py b/tests/twisted/dispatcher/lose-text.py
index d652658c..42083c2c 100644
--- a/tests/twisted/dispatcher/lose-text.py
+++ b/tests/twisted/dispatcher/lose-text.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/recover-from-disconnect.py b/tests/twisted/dispatcher/recover-from-disconnect.py
index 48167711..9e0d3c42 100644
--- a/tests/twisted/dispatcher/recover-from-disconnect.py
+++ b/tests/twisted/dispatcher/recover-from-disconnect.py
@@ -48,13 +48,10 @@ def test(q, bus, mc):
# wait for MC to download the properties
expect_client_setup(q, [empathy, kopete])
- cm_name_ref = dbus.service.BusName(
- tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
-
# Create an account
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/dispatcher/redispatch-channels.py b/tests/twisted/dispatcher/redispatch-channels.py
index 6178a379..41800b1c 100644
--- a/tests/twisted/dispatcher/redispatch-channels.py
+++ b/tests/twisted/dispatcher/redispatch-channels.py
@@ -185,7 +185,7 @@ def test_delegate_channel(q, bus, mc, account, conn, chan, empathy, empathy_bus,
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/request-disabled-account.py b/tests/twisted/dispatcher/request-disabled-account.py
index adb3ca27..c3f1640b 100644
--- a/tests/twisted/dispatcher/request-disabled-account.py
+++ b/tests/twisted/dispatcher/request-disabled-account.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "smcv@example.com",
"password": "secrecy"}, signature='sv')
- (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+ (simulated_cm, account) = create_fakecm_account(q, bus, mc, params)
account_iface = dbus.Interface(account, cs.ACCOUNT)
account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
diff --git a/tests/twisted/dispatcher/respawn-activatable-observers.py b/tests/twisted/dispatcher/respawn-activatable-observers.py
index 8f83ffbb..14727b40 100644
--- a/tests/twisted/dispatcher/respawn-activatable-observers.py
+++ b/tests/twisted/dispatcher/respawn-activatable-observers.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/respawn-observers.py b/tests/twisted/dispatcher/respawn-observers.py
index 81061ae6..bf69a794 100644
--- a/tests/twisted/dispatcher/respawn-observers.py
+++ b/tests/twisted/dispatcher/respawn-observers.py
@@ -34,7 +34,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/some-delay-approvers.py b/tests/twisted/dispatcher/some-delay-approvers.py
index e06b13a6..16e0b7b0 100644
--- a/tests/twisted/dispatcher/some-delay-approvers.py
+++ b/tests/twisted/dispatcher/some-delay-approvers.py
@@ -29,7 +29,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/undispatchable.py b/tests/twisted/dispatcher/undispatchable.py
index de63fbca..8a18ec03 100644
--- a/tests/twisted/dispatcher/undispatchable.py
+++ b/tests/twisted/dispatcher/undispatchable.py
@@ -35,7 +35,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
text_fixed_properties = dbus.Dictionary({
diff --git a/tests/twisted/dispatcher/vanishing-client.py b/tests/twisted/dispatcher/vanishing-client.py
index 92a4079b..143ea4cb 100644
--- a/tests/twisted/dispatcher/vanishing-client.py
+++ b/tests/twisted/dispatcher/vanishing-client.py
@@ -33,7 +33,7 @@ import constants as cs
def test(q, bus, mc):
params = dbus.Dictionary({"account": "someguy@example.com",
"password": "secrecy"}, signature='sv')
- cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
+ simulated_cm, account = create_fakecm_account(q, bus, mc, params)
conn = enable_fakecm_account(q, bus, mc, account, params)
bus_name = '.'.join([tp_name_prefix, 'Client.CrashMe'])
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py
index 653cba1e..debc6f41 100644
--- a/tests/twisted/mctest.py
+++ b/tests/twisted/mctest.py
@@ -1005,11 +1005,155 @@ class SimulatedClient(object):
self.q.dbus_return(e.message, self.recover, signature='v',
bus=self.bus)
+class SimulatedConnectionManager(object):
+ def __init__(self, q, bus, cm_name='fakecm',
+ protocol_names=['fakeprotocol'],
+ has_account_storage=False):
+ self.q = q
+ self.bus = bus
+ self.cm_name = cm_name
+ self.bus_name = '.'.join([cs.CM, cm_name])
+ self._bus_name_ref = dbus.service.BusName(self.bus_name, self.bus)
+ self.object_path = '/' + self.bus_name.replace('.', '/')
+ self.has_account_storage = has_account_storage
+ self.protocol_names = list(protocol_names)
+
+ q.add_dbus_method_impl(self.GetAll_CM,
+ path=self.object_path,
+ interface=cs.PROPERTIES_IFACE, method='GetAll',
+ args=[cs.CM])
+
+ for protocol_name in protocol_names:
+ assert '-' not in protocol_name
+ q.add_dbus_method_impl(self.IdentifyAccount,
+ path=self.object_path + '/' + protocol_name,
+ interface=cs.PROTOCOL, method='IdentifyAccount')
+ q.add_dbus_method_impl(self.NormalizeContact,
+ path=self.object_path + '/' + protocol_name,
+ interface=cs.PROTOCOL, method='NormalizeContact')
+
+ def release_name(self):
+ del self._bus_name_ref
+
+ def reacquire_name(self):
+ self._bus_name_ref = dbus.service.BusName(self.bus_name, self.bus)
+
+ def get_protocols(self):
+ ret = dbus.Dictionary(signature='sa{sv}')
+
+ for p in self.protocol_names:
+ # stub: assume all the protocols look "reasonably normal"
+ ret[p] = {
+ cs.PROTOCOL + '.Interfaces': dbus.Array(signature='s'),
+ cs.PROTOCOL + '.ConnectionInterfaces':
+ dbus.Array(signature='s'),
+ cs.PROTOCOL + '.RequestableChannelClasses':
+ dbus.Array(signature='(a{sv}as)'),
+ cs.PROTOCOL + '.VCardField': 'x-' + self.cm_name,
+ cs.PROTOCOL + '.EnglishName': self.cm_name,
+ cs.PROTOCOL + '.Icon': 'im-' + self.cm_name,
+ cs.PROTOCOL + '.AuthenticationTypes':
+ dbus.Array(signature='s'),
+ cs.PROTOCOL + '.Parameters': dbus.Array([
+ ('account', cs.PARAM_REQUIRED, 's', ''),
+ ('password', cs.PARAM_SECRET, 's', ''),
+ ], signature='(susv)'),
+ }
+
+ if self.cm_name == 'fakecm' and p == 'fakeprotocol':
+ ret[p][cs.PROTOCOL + '.Parameters'] = dbus.Array([
+ ('account', cs.PARAM_REQUIRED|cs.PARAM_REGISTER,
+ 's', ''),
+ ('password',
+ cs.PARAM_SECRET|cs.PARAM_REQUIRED|cs.PARAM_REGISTER,
+ 's', ''),
+ ('nickname', cs.PARAM_REGISTER, 's', ''),
+ ('register', cs.PARAM_HAS_DEFAULT, 'b', False),
+ ('com.example.Badgerable.Badgered',
+ cs.PARAM_HAS_DEFAULT|cs.PARAM_DBUS_PROPERTY,
+ 'b', False),
+ ('secret-mushroom', cs.PARAM_SECRET, 's', ''),
+ ('snakes', 0, 'u', dbus.UInt32(0)),
+ ('contrived-example', cs.PARAM_HAS_DEFAULT, 'u',
+ dbus.UInt32(5)),
+ ], signature='(susv)')
+
+ if self.cm_name == 'onewitheverything' and p == 'serializable':
+ ret[p][cs.PROTOCOL + '.Parameters'] = dbus.Array([
+ ('s', cs.PARAM_REQUIRED, 's', ''),
+ ('o', 0, 'o', dbus.ObjectPath('/')),
+ ('b', 0, 'b', False),
+ ('q', 0, 'q', dbus.UInt16(0)),
+ ('u', 0, 'u', dbus.UInt32(0)),
+ ('t', 0, 't', dbus.UInt64(0)),
+ ('n', 0, 'n', dbus.Int16(0)),
+ ('i', 0, 'i', dbus.Int32(0)),
+ ('x', 0, 'x', dbus.Int64(0)),
+ ('d', 0, 'd', 0.0),
+ ('as', 0, 'as', dbus.Array(signature=s)),
+ ('y', 0, 'y', dbus.Byte(0)),
+ ], signature='(susv)')
+
+ if self.cm_name == 'onewitheverything' and p == 'defaults':
+ ret[p][cs.PROTOCOL + '.Parameters'] = dbus.Array([
+ ('s', cs.PARAM_HAS_DEFAULT, 's', 'foo'),
+ ('o', cs.PARAM_HAS_DEFAULT, 'o', dbus.ObjectPath('/foo')),
+ ('b', cs.PARAM_HAS_DEFAULT, 'b', True),
+ ('q', cs.PARAM_HAS_DEFAULT, 'q', dbus.UInt16(1)),
+ ('u', cs.PARAM_HAS_DEFAULT, 'u', dbus.UInt32(1)),
+ ('t', cs.PARAM_HAS_DEFAULT, 't', dbus.UInt64(1)),
+ ('n', cs.PARAM_HAS_DEFAULT, 'n', dbus.Int16(-1)),
+ ('i', cs.PARAM_HAS_DEFAULT, 'i', dbus.Int32(-1)),
+ ('x', cs.PARAM_HAS_DEFAULT, 'x', dbus.Int64(-1)),
+ ('d', cs.PARAM_HAS_DEFAULT, 'd', 1.5),
+ ('as', cs.PARAM_HAS_DEFAULT, 'as',
+ dbus.Array(['foo', 'bar', 'baz'], signature=s)),
+ ('y', cs.PARAM_HAS_DEFAULT, 'y', dbus.Byte(1)),
+ ], signature='(susv)')
+
+ if self.cm_name == 'onewitheverything' and p == 'flags':
+ ret[p][cs.PROTOCOL + '.Parameters'] = dbus.Array([
+ ('account', cs.PARAM_REQUIRED|cs.PARAM_REGISTER, 's', ''),
+ ('name', cs.PARAM_REGISTER, 's', ''),
+ ('key',
+ cs.PARAM_REGISTER|cs.PARAM_REQUIRED|cs.PARAM_SECRET,
+ 's', ''),
+ ('com.example.Badgerable.Badgers', cs.PARAM_DBUS_PROPERTY,
+ 's', ''),
+ ], signature='(susv)')
+
+ return ret
+
+ def get_interfaces(self):
+ ret = dbus.Array([], signature='s')
+
+ if self.has_account_storage:
+ ret.append(cs.CM_IFACE_ACCOUNT_STORAGE)
+
+ return ret
+
+ def GetAll_CM(self, e):
+ self.q.dbus_return(e.message, {
+ 'Protocols': self.get_protocols(),
+ 'Interfaces': self.get_interfaces(),
+ }, signature='a{sv}', bus=self.bus)
+
+ def IdentifyAccount(self, e):
+ if 'account' in e.args[0]:
+ ret = e.args[0]['account'].lower()
+ else:
+ ret = 'account'
+ self.q.dbus_return(e.message, ret, signature='s')
+
+ def NormalizeContact(self, e):
+ self.q.dbus_return(e.message, e.args[0].lower(), signature='s')
+
def take_fakecm_name(bus):
return dbus.service.BusName(cs.CM + '.fakecm', bus=bus)
def create_fakecm_account(q, bus, mc, params, properties={},
- cm_bus=None):
+ cm_bus=None, simulated_cm=None,
+ cm_name='fakecm', protocol_name='fakeprotocol'):
"""Create a fake connection manager and an account that uses it.
Optional keyword arguments:
@@ -1024,12 +1168,14 @@ def create_fakecm_account(q, bus, mc, params, properties={},
if cm_bus is None:
cm_bus = bus
- cm_name_ref = take_fakecm_name(cm_bus)
+ if simulated_cm is None:
+ simulated_cm = SimulatedConnectionManager(q, bus,
+ cm_name=cm_name, protocol_names=[protocol_name])
account_manager = AccountManager(bus)
servicetest.call_async(q, account_manager, 'CreateAccount',
- 'fakecm', 'fakeprotocol', 'fakeaccount', params, properties)
+ cm_name, protocol_name, 'fakeaccount', params, properties)
validity_changed_pattern = servicetest.EventPattern('dbus-signal',
path=cs.AM_PATH, signal='AccountValidityChanged', interface=cs.AM)
@@ -1056,7 +1202,7 @@ def create_fakecm_account(q, bus, mc, params, properties={},
interface, prop = key.rsplit('.', 1)
servicetest.assertEquals(value, account.Properties.Get(interface, prop))
- return (cm_name_ref, account)
+ return (simulated_cm, account)
def get_fakecm_account(bus, mc, account_path):
account = Account(bus, account_path)
@@ -1096,19 +1242,25 @@ def expect_fakecm_connection(q, bus, mc, account, expected_params,
extra_interfaces=[],
expect_before_connect=(), expect_after_connect=(),
has_hidden=False,
- self_ident='myself'):
+ self_ident='myself',
+ cm_name='fakecm',
+ protocol_name='fakeprotocol'):
# make (safely) mutable copies
expect_before_connect = list(expect_before_connect)
expect_after_connect = list(expect_after_connect)
+ # for simplicity we assume the sort of name that is invariant between
+ # Telepathy 0 and Telepathy 1
+ assert '-' not in protocol_name
+
e = q.expect('dbus-method-call', method='RequestConnection',
- args=['fakeprotocol', expected_params],
- destination=cs.tp_name_prefix + '.ConnectionManager.fakecm',
- path=cs.tp_path_prefix + '/ConnectionManager/fakecm',
- interface=cs.tp_name_prefix + '.ConnectionManager',
+ args=[protocol_name, expected_params],
+ destination=cs.CM + '.' + cm_name,
+ path='/' + cs.CM.replace('.', '/') + '/' + cm_name,
+ interface=cs.CM,
handled=False)
- conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol',
+ conn = SimulatedConnection(q, bus, cm_name, protocol_name,
account.object_path.split('/')[-1],
self_ident, has_requests=has_requests, has_presence=has_presence,
has_aliasing=has_aliasing, has_avatars=has_avatars,