[telepathy-mission-control/master] account-manager/enable-auto-connect.py: assert that when a Valid, ConnectAutomatically account becomes Enabled, it goes online
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Jun 25 08:09:48 PDT 2009
---
test/twisted/Makefile.am | 1 +
.../twisted/account-manager/enable-auto-connect.py | 57 ++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 test/twisted/account-manager/enable-auto-connect.py
diff --git a/test/twisted/Makefile.am b/test/twisted/Makefile.am
index 9b902d4..a642d83 100644
--- a/test/twisted/Makefile.am
+++ b/test/twisted/Makefile.am
@@ -6,6 +6,7 @@ TWISTED_BASIC_TESTS = \
account-manager/avatar.py \
account-manager/create-auto-connect.py \
account-manager/create-with-properties.py \
+ account-manager/enable-auto-connect.py \
account-manager/nickname.py \
account-manager/old-create-with-properties.py \
account-manager/param-types.py \
diff --git a/test/twisted/account-manager/enable-auto-connect.py b/test/twisted/account-manager/enable-auto-connect.py
new file mode 100644
index 0000000..e41a42f
--- /dev/null
+++ b/test/twisted/account-manager/enable-auto-connect.py
@@ -0,0 +1,57 @@
+import dbus
+import dbus.service
+
+from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
+ call_async
+from mctest import exec_test, create_fakecm_account
+import constants as cs
+
+def test(q, bus, mc):
+ account_manager = bus.get_object(cs.AM, cs.AM_PATH)
+ account_manager_iface = dbus.Interface(account_manager, cs.AM)
+
+ params = dbus.Dictionary({"account": "smcv at example.com",
+ "password": "secrecy"}, signature='sv')
+ (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
+
+ account_iface = dbus.Interface(account, cs.ACCOUNT)
+ account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
+
+ # Ensure that it's enabled but has offline RP
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
+ (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
+ q.expect('dbus-return', method='Set')
+ q.expect('dbus-signal', signal='AccountPropertyChanged',
+ predicate=lambda e:
+ e.args[0].get('RequestedPresence', (None, None, None))[1]
+ == 'offline')
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'AutomaticPresence',
+ (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy',
+ 'Testing automatic presence'))
+ q.expect('dbus-return', method='Set')
+ q.expect('dbus-signal', signal='AccountPropertyChanged',
+ predicate=lambda e:
+ e.args[0].get('AutomaticPresence', (None, None, None))[1]
+ == 'busy')
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'Enabled', False)
+ q.expect('dbus-return', method='Set')
+
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'ConnectAutomatically',
+ True)
+ q.expect('dbus-return', method='Set')
+
+ # Go online by enabling the account
+ call_async(q, account_props, 'Set', cs.ACCOUNT, 'Enabled', True)
+
+ e = q.expect('dbus-method-call', method='RequestConnection',
+ args=['fakeprotocol', params],
+ destination=cs.tp_name_prefix + '.ConnectionManager.fakecm',
+ path=cs.tp_path_prefix + '/ConnectionManager/fakecm',
+ interface=cs.tp_name_prefix + '.ConnectionManager',
+ handled=False)
+
+if __name__ == '__main__':
+ exec_test(test, {})
--
1.5.6.5
More information about the telepathy-commits
mailing list