[Telepathy-commits] [telepathy-mission-control/master] test-account.py: improve assertions about interfaces
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Mar 25 11:21:51 PDT 2009
* assert in such a way that if interfaces are added or re-ordered, the
test will continue to pass
* don't assert that AccountManager is among the AM interfaces - there's no
point in listing an interface that the caller clearly already knows
we have
* likewise for Account
---
test/twisted/test-account.py | 28 +++++++++++++++-------------
1 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/test/twisted/test-account.py b/test/twisted/test-account.py
index c9be1f2..2c29d65 100644
--- a/test/twisted/test-account.py
+++ b/test/twisted/test-account.py
@@ -26,15 +26,16 @@ def test(q, bus, mc):
'org.freedesktop.Telepathy.AccountManager',
dbus_interface='org.freedesktop.DBus.Properties')
assert properties is not None
- assert properties.get('Interfaces') == [
- 'org.freedesktop.Telepathy.AccountManager',
- 'com.nokia.AccountManager.Interface.Query',
- 'org.freedesktop.Telepathy.AccountManager.Interface.Creation.DRAFT'
- ], properties.get('Interfaces')
assert properties.get('ValidAccounts') == [], \
properties.get('ValidAccounts')
assert properties.get('InvalidAccounts') == [], \
properties.get('InvalidAccounts')
+ interfaces = properties.get('Interfaces')
+
+ # assert that current functionality exists
+ assert 'com.nokia.AccountManager.Interface.Query' in interfaces, interfaces
+ assert 'org.freedesktop.Telepathy.AccountManager.Interface.Creation.DRAFT'\
+ in interfaces, interfaces
# Create an account
params = dbus.Dictionary({"nickname": "fakenick"}, signature='sv')
@@ -72,14 +73,7 @@ def test(q, bus, mc):
'org.freedesktop.Telepathy.Account',
dbus_interface='org.freedesktop.DBus.Properties')
assert properties is not None
- assert 'org.freedesktop.Telepathy.Account' \
- in properties.get('Interfaces'), properties.get('Interfaces')
- assert 'org.freedesktop.Telepathy.Account.Interface.Avatar' \
- in properties.get('Interfaces'), properties.get('Interfaces')
- assert 'org.freedesktop.Telepathy.Account.Interface.Compat' \
- in properties.get('Interfaces'), properties.get('Interfaces')
- assert 'com.nokia.Account.Interface.Conditions' \
- in properties.get('Interfaces'), properties.get('Interfaces')
+
assert properties.get('DisplayName') == 'fakeaccount', \
properties.get('DisplayName')
assert properties.get('Icon') == '', properties.get('Icon')
@@ -91,6 +85,14 @@ def test(q, bus, mc):
assert properties.get('NormalizedName') == '', \
properties.get('NormalizedName')
+ interfaces = properties.get('Interfaces')
+ assert 'org.freedesktop.Telepathy.Account.Interface.Avatar' \
+ in interfaces, interfaces
+ assert 'org.freedesktop.Telepathy.Account.Interface.Compat' \
+ in interfaces, interfaces
+ assert 'com.nokia.Account.Interface.Conditions' \
+ in interfaces, interfaces
+
# 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