[Telepathy-commits] [telepathy-mission-control/master] test-account.py: exercise miscellaneous read/write properties
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Mar 25 12:20:42 PDT 2009
---
test/twisted/test-account.py | 46 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/test/twisted/test-account.py b/test/twisted/test-account.py
index e13e9c1..d76dbcf 100644
--- a/test/twisted/test-account.py
+++ b/test/twisted/test-account.py
@@ -1,6 +1,7 @@
import dbus
-from servicetest import EventPattern, tp_name_prefix, tp_path_prefix
+from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
+ call_async
from fakecm import start_fake_connection_manager
from mctest import exec_test
import constants as cs
@@ -58,13 +59,14 @@ def test(q, bus, mc):
tp_name_prefix + '.AccountManager',
account_path)
account_iface = dbus.Interface(account, cs.ACCOUNT)
+ account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
# Introspect Account for debugging purpose
account_introspected = account.Introspect(
dbus_interface=cs.INTROSPECTABLE_IFACE)
#print account_introspected
# Check Account has D-Bus property interface
- properties = account.GetAll(cs.ACCOUNT, dbus_interface=cs.PROPERTIES_IFACE)
+ properties = account_props.GetAll(cs.ACCOUNT)
assert properties is not None
assert properties.get('DisplayName') == 'fakeaccount', \
@@ -83,6 +85,46 @@ def test(q, bus, mc):
assert cs.ACCOUNT_IFACE_NOKIA_COMPAT in interfaces, interfaces
assert cs.ACCOUNT_IFACE_NOKIA_CONDITIONS in interfaces, interfaces
+ # sanity check
+ for k in properties:
+ assert account_props.Get(cs.ACCOUNT, k) == properties[k], k
+
+ # Alter some miscellaneous r/w properties
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'DisplayName',
+ 'Work account')
+ q.expect_many(
+ EventPattern('dbus-signal',
+ path=account_path,
+ signal='AccountPropertyChanged',
+ interface=cs.ACCOUNT,
+ args=[{'DisplayName': 'Work account'}]),
+ EventPattern('dbus-return', method='Set'),
+ )
+ assert account_props.Get(cs.ACCOUNT, 'DisplayName') == 'Work account'
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'Icon', 'im-jabber')
+ q.expect_many(
+ EventPattern('dbus-signal',
+ path=account_path,
+ signal='AccountPropertyChanged',
+ interface=cs.ACCOUNT,
+ args=[{'Icon': 'im-jabber'}]),
+ EventPattern('dbus-return', method='Set'),
+ )
+ assert account_props.Get(cs.ACCOUNT, 'Icon') == 'im-jabber'
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'Nickname', 'Joe Bloggs')
+ q.expect_many(
+ EventPattern('dbus-signal',
+ path=account_path,
+ signal='AccountPropertyChanged',
+ interface=cs.ACCOUNT,
+ args=[{'Nickname': 'Joe Bloggs'}]),
+ EventPattern('dbus-return', method='Set'),
+ )
+ assert account_props.Get(cs.ACCOUNT, 'Nickname') == 'Joe Bloggs'
+
# Delete the account
assert account_iface.Remove() is None
account_event, account_manager_event = q.expect_many(
--
1.5.6.5
More information about the telepathy-commits
mailing list