diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-12-22 11:04:25 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2010-12-22 11:21:26 +0000 |
commit | 1d9f17613ac2ce1dc3928ab0848d7b9b987b6330 (patch) | |
tree | aba4ec31a306e80f9d17797b6899a27a6d1516d0 | |
parent | 9ad89fea078ea23178a99608fc18b753bd6f2005 (diff) |
create-with-properties: remove unsound signal expectation
When this test creates a new account, it expects four events to occur:
• A.AccountPropertyChanged, to say the new account is valid;
• AM.AccountValidityChanged, to say the new account is valid;
• CreateAccount returning successfully;
• RequestConnection on the fake CM, because ConnectAutomatically was
set to True and RequestedPresence was set to non-offline in
CreateAccount.
However, if the account's not yet been announced by
AccountValidityChanged, MC has no reason to emit AccountPropertyChanged
on it. It happens that, in some cases, it does; but this depends on
whether or not MC has already introspected the fake CM by the time the
account is created. So the test is wrong to expect
AccountPropertyChanged. Instead, we check that Account.Valid is in sync
with what AccountValidityChanged said.
This fixes an issue where this test would only pass if it was run after
account-manager/create-twice, but not if it was run individually.
-rw-r--r-- | test/twisted/account-manager/create-with-properties.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/twisted/account-manager/create-with-properties.py b/test/twisted/account-manager/create-with-properties.py index 787c7e02..5aabfc76 100644 --- a/test/twisted/account-manager/create-with-properties.py +++ b/test/twisted/account-manager/create-with-properties.py @@ -100,10 +100,7 @@ def test(q, bus, mc): # FIXME: MC ought to also introspect the CM and find out that the params # are in fact sufficient - a_signal, am_signal, ret, rc = q.expect_many( - EventPattern('dbus-signal', - signal='AccountPropertyChanged', interface=cs.ACCOUNT, - predicate=(lambda e: 'Valid' in e.args[0])), + am_signal, ret, rc = q.expect_many( EventPattern('dbus-signal', path=cs.AM_PATH, signal='AccountValidityChanged', interface=cs.AM), EventPattern('dbus-return', method='CreateAccount'), @@ -111,7 +108,6 @@ def test(q, bus, mc): ) account_path = ret.value[0] assert am_signal.args == [account_path, True], am_signal.args - assert a_signal.args[0]['Valid'] == True, a_signal.args assert account_path is not None @@ -131,6 +127,8 @@ def test(q, bus, mc): properties.get('ConnectAutomatically') assert properties.get('Enabled') == True, \ properties.get('Enabled') + assert properties.get('Valid') == True, \ + properties.get('Valid') assert properties.get('Icon') == 'quake3arena', \ properties.get('Icon') assert properties.get('Nickname') == 'AnArKi', \ |