diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-14 12:08:44 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-14 13:39:36 +0000 |
commit | d9a702e8c7dfd80c0f7064824e4bf9498c420cf3 (patch) | |
tree | cdd1afac2c72654d4f44b4dec56468df7d4e0271 | |
parent | 4ee0376efd35ce0e06d14633e386c511938e26a3 (diff) | |
download | telepathy-mission-control-d9a702e8c7dfd80c0f7064824e4bf9498c420cf3.tar.gz |
Test the Supersedes property
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=42814
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | tests/twisted/account-manager/account-basics.py | 21 | ||||
-rw-r--r-- | tests/twisted/account-manager/create-with-properties.py | 15 | ||||
-rw-r--r-- | tests/twisted/constants.py | 3 |
3 files changed, 34 insertions, 5 deletions
diff --git a/tests/twisted/account-manager/account-basics.py b/tests/twisted/account-manager/account-basics.py index 1a8e86eb..aceb7aed 100644 --- a/tests/twisted/account-manager/account-basics.py +++ b/tests/twisted/account-manager/account-basics.py @@ -1,5 +1,5 @@ # Copyright (C) 2009 Nokia Corporation -# Copyright (C) 2009 Collabora Ltd. +# Copyright (C) 2009-2012 Collabora Ltd. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ import dbus import dbus.service from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \ - call_async + call_async, assertEquals from mctest import exec_test, create_fakecm_account, get_account_manager import constants as cs @@ -162,6 +162,23 @@ def test(q, bus, mc): assert account_props.Get(cs.ACCOUNT_IFACE_NOKIA_CONDITIONS, 'Condition') == {':foo': 'bar'} + assertEquals(dbus.Array(signature='o'), + account_props.Get(cs.ACCOUNT, 'Supersedes')) + call_async(q, account_props, 'Set', cs.ACCOUNT, 'Supersedes', + dbus.Array([cs.ACCOUNT_PATH_PREFIX + 'x/y/z'], + signature='o')) + q.expect_many( + EventPattern('dbus-signal', + path=account_path, + signal='AccountPropertyChanged', + interface=cs.ACCOUNT, + args=[{'Supersedes': [cs.ACCOUNT_PATH_PREFIX + 'x/y/z']}]), + EventPattern('dbus-return', method='Set'), + ) + assertEquals(dbus.Array([cs.ACCOUNT_PATH_PREFIX + 'x/y/z'], + signature='o'), + account_props.Get(cs.ACCOUNT, 'Supersedes')) + # Set some properties to invalidly typed values - this currently succeeds # but is a no-op, although in future it should change to raising an # exception diff --git a/tests/twisted/account-manager/create-with-properties.py b/tests/twisted/account-manager/create-with-properties.py index d5e9685e..ca3b50d2 100644 --- a/tests/twisted/account-manager/create-with-properties.py +++ b/tests/twisted/account-manager/create-with-properties.py @@ -1,5 +1,5 @@ # Copyright (C) 2009 Nokia Corporation -# Copyright (C) 2009 Collabora Ltd. +# Copyright (C) 2009-2012 Collabora Ltd. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -21,7 +21,7 @@ import dbus import dbus.service from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \ - call_async + call_async, assertEquals from mctest import exec_test, create_fakecm_account, AccountManager import constants as cs @@ -52,6 +52,7 @@ def test(q, bus, mc): assert (cs.ACCOUNT_IFACE_NOKIA_CONDITIONS + '.Condition') in supported assert (cs.ACCOUNT + '.RequestedPresence') in supported + assert (cs.ACCOUNT + '.Supersedes') in supported params = dbus.Dictionary({"account": "anarki@example.com", "password": "secrecy"}, signature='sv') @@ -76,6 +77,10 @@ def test(q, bus, mc): dbus.Array(['x-ioquake3', 'x-quake3'], signature='s'), cs.ACCOUNT_IFACE_NOKIA_CONDITIONS + '.Condition': dbus.Dictionary({ 'has-quad-damage': ':y' }, signature='ss'), + cs.ACCOUNT + '.Supersedes': dbus.Array([ + cs.ACCOUNT_PATH_PREFIX + 'q1/q1/Ranger', + cs.ACCOUNT_PATH_PREFIX + 'q2/q2/Grunt', + ], signature='o'), }, signature='sv') call_async(q, account_manager, 'CreateAccount', @@ -122,6 +127,12 @@ def test(q, bus, mc): properties.get('Icon') assert properties.get('Nickname') == 'AnArKi', \ properties.get('Nickname') + assertEquals( + dbus.Array([ + cs.ACCOUNT_PATH_PREFIX + 'q1/q1/Ranger', + cs.ACCOUNT_PATH_PREFIX + 'q2/q2/Grunt', + ], signature='o'), + properties.get('Supersedes')) properties = account_props.GetAll(cs.ACCOUNT_IFACE_AVATAR) assert properties.get('Avatar') == ([ord('f'), ord('o'), ord('o')], diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py index 4ba24ef7..11587ad2 100644 --- a/tests/twisted/constants.py +++ b/tests/twisted/constants.py @@ -1,5 +1,5 @@ # Copyright (C) 2009 Nokia Corporation -# Copyright (C) 2009 Collabora Ltd. +# Copyright (C) 2009-2012 Collabora Ltd. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -173,6 +173,7 @@ ACCOUNT_IFACE_ADDRESSING = ACCOUNT + '.Interface.Addressing' ACCOUNT_IFACE_HIDDEN = ACCOUNT + '.Interface.Hidden.DRAFT1' ACCOUNT_IFACE_NOKIA_COMPAT = 'com.nokia.Account.Interface.Compat' ACCOUNT_IFACE_NOKIA_CONDITIONS = 'com.nokia.Account.Interface.Conditions' +ACCOUNT_PATH_PREFIX = tp_path_prefix + '/Account/' AM = tp_name_prefix + '.AccountManager' AM_IFACE_HIDDEN = AM + '.Interface.Hidden.DRAFT1' |