summaryrefslogtreecommitdiff
path: root/tests/twisted
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-11-08 16:56:21 +0000
committerXavier Claessens <xavier.claessens@collabora.co.uk>2013-11-08 16:54:53 -0500
commit100fcffec5f53ff19c101114633198d468722349 (patch)
treed1d1a2bc16b0c999f49baf6dae91ea0a825cb20d /tests/twisted
parent7825a35bd44859830b8db0f37846457bd1e9aedb (diff)
Allow backends, but not D-Bus clients, to delete restricted accounts
I assumed that if TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED or TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PRESENCE, then a hypothetical CANNOT_DELETE flag would also have been present.
Diffstat (limited to 'tests/twisted')
-rw-r--r--tests/twisted/account-manager/restricted-storage.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/twisted/account-manager/restricted-storage.py b/tests/twisted/account-manager/restricted-storage.py
index bf01a2cc..6724863b 100644
--- a/tests/twisted/account-manager/restricted-storage.py
+++ b/tests/twisted/account-manager/restricted-storage.py
@@ -142,6 +142,9 @@ def test(q, bus, mc, fake_accounts_service=None, **kwargs):
'ConnectAutomatically', not online)
q.expect('dbus-error', method='Set')
+ call_async(q, account, 'Remove')
+ q.expect('dbus-error', method='Remove')
+
# ... but the backend can still change them
if enabled and online:
q.forbid_events(try_to_connect)
@@ -159,7 +162,24 @@ def test(q, bus, mc, fake_accounts_service=None, **kwargs):
'Enabled': True,
'ConnectAutomatically': True,
})
- q.expect_many(*try_to_connect)
+
+ events = q.expect_many(*try_to_connect)
+ conn = SimulatedConnection(q, bus, 'fakecm', 'fakeprotocol',
+ account_tail.replace('/', '_'), 'ezio',
+ has_presence=True)
+ q.dbus_return(events[-1].message, conn.bus_name,
+ conn.object_path, signature='so')
+
+ # we are connected: deleting the account should
+ # disconnect us
+ fake_accounts_service.delete_account(account_tail)
+ q.expect_many(
+ EventPattern('dbus-signal', signal='AccountRemoved',
+ args=[account_path]),
+ EventPattern('dbus-signal', signal='Removed',
+ path=account_path),
+ EventPattern('dbus-method-call', method='Disconnect'),
+ )
if __name__ == '__main__':
exec_test(test, {}, pass_kwargs=True)