summaryrefslogtreecommitdiff
path: root/tests/twisted/account-manager/presence.py
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-11-03 11:53:28 +0000
committerWill Thompson <will.thompson@collabora.co.uk>2011-11-03 11:59:07 +0000
commitbe2e5c2d899d9542b567983e809caf371ba9be6c (patch)
tree1538bfb4746b839127819adf89ac7a49a5d336b6 /tests/twisted/account-manager/presence.py
parentcc746edd95fdc1802cd656eca664a7089de61745 (diff)
parent82f1d4b02a32131b48ea9e461865415070ab7b72 (diff)
Merge branch 'ChangingPresence'
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Fixes: <https://bugs.freedesktop.org/show_bug.cgi?id=42548>
Diffstat (limited to 'tests/twisted/account-manager/presence.py')
-rwxr-xr-xtests/twisted/account-manager/presence.py44
1 files changed, 38 insertions, 6 deletions
diff --git a/tests/twisted/account-manager/presence.py b/tests/twisted/account-manager/presence.py
index abef3b00..5577f5a6 100755
--- a/tests/twisted/account-manager/presence.py
+++ b/tests/twisted/account-manager/presence.py
@@ -30,13 +30,45 @@ def test(q, bus, mc):
"password": "ionstorm"}, signature='sv')
(cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
- account_iface = dbus.Interface(account, cs.ACCOUNT)
- account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
-
- # Go online with a particular presence
presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
'Fighting conspiracies'), signature='uss')
+ def mk_offline(message=''):
+ return dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline',
+ message), signature='uss')
+
+ offline = mk_offline()
+
+ # While the account is disabled, pushing stuff into RequestedPresence
+ # should not make ChangingPresence become True.
+ assert not account.Properties.Get(cs.ACCOUNT, 'Enabled')
+ assert not account.Properties.Get(cs.ACCOUNT, 'ChangingPresence')
+ events = [
+ EventPattern('dbus-signal', signal='AccountPropertyChanged',
+ predicate=lambda e: 'ChangingPresence' in e.args[0]),
+ EventPattern('dbus-method-call', method='RequestConnection'),
+ ]
+ q.forbid_events(events)
+ account.Properties.Set(cs.ACCOUNT, 'RequestedPresence', presence)
+ account.Properties.Set(cs.ACCOUNT, 'RequestedPresence', offline)
+ account.Properties.Set(cs.ACCOUNT, 'RequestedPresence', presence)
+ account.Properties.Set(cs.ACCOUNT, 'RequestedPresence', offline)
+
+ # Check that changing the message associated with our requested offline
+ # presence doesn't make anything happen either.
+ account.Properties.Set(cs.ACCOUNT, 'RequestedPresence',
+ mk_offline('byeeee'))
+
+ # Enable the account; RequestedPresence is still offline, so this should
+ # have no effect on ChangingPresence.
+ account.Properties.Set(cs.ACCOUNT, 'Enabled', True)
+ account.Properties.Set(cs.ACCOUNT, 'Enabled', False)
+
+ sync_dbus(bus, q, account)
+ assert not account.Properties.Get(cs.ACCOUNT, 'ChangingPresence')
+ q.unforbid_events(events)
+
+ # Go online with a particular presence
log = []
# FIXME: using predicate for its side-effects here is weird
@@ -92,7 +124,7 @@ def test(q, bus, mc):
# Change requested presence after going online
presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_AWAY), 'away',
'In Hong Kong'), signature='uss')
- call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
+ call_async(q, account.Properties, 'Set', cs.ACCOUNT, 'RequestedPresence',
presence)
e, _, _ = q.expect_many(
@@ -121,7 +153,7 @@ def test(q, bus, mc):
presence = dbus.Struct((dbus.UInt32(cs.PRESENCE_TYPE_AWAY), 'away',
'In Hong Kong'), signature='uss')
- call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
+ call_async(q, account.Properties, 'Set', cs.ACCOUNT, 'RequestedPresence',
presence)
e = q.expect('dbus-method-call',