diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-05-04 15:22:49 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2009-05-05 12:17:57 +0100 |
commit | 2351333b53553e37ed0e60c2ac3cd7811c7dede6 (patch) | |
tree | 04dfa4b31e3eee142f1beef185b9f9a5e9fe10b4 | |
parent | faa9895e882649c7c3f24a2518c1285738e4f394 (diff) |
test-account.py: make sure we can set properties to wrong types without crashing
-rw-r--r-- | test/twisted/test-account.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/twisted/test-account.py b/test/twisted/test-account.py index 5a06ef7b..27fc0a81 100644 --- a/test/twisted/test-account.py +++ b/test/twisted/test-account.py @@ -125,6 +125,67 @@ def test(q, bus, mc): ) assert account_props.Get(cs.ACCOUNT, 'HasBeenOnline') == True + # 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 + + try: + account_props.Set(cs.ACCOUNT, 'DisplayName', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'Icon', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'Enabled', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'Nickname', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'AutomaticPresence', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'ConnectAutomatically', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT, 'RequestedPresence', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + try: + account_props.Set(cs.ACCOUNT_IFACE_AVATAR, 'Avatar', + dbus.Struct(('wrongly typed',), signature='s')) + except dbus.DBusException: + pass + + # Make sure MC hasn't crashed yet, and make sure some properties are what + # we expect them to be + + properties = account_props.GetAll(cs.ACCOUNT) + assert properties['DisplayName'] == 'Work account' + assert properties['Icon'] == 'im-jabber' + properties = account_props.GetAll(cs.ACCOUNT_IFACE_AVATAR) + assert properties['Avatar'] == ([], '') + # Delete the account assert account_iface.Remove() is None account_event, account_manager_event = q.expect_many( |