~ubuntu-branches/ubuntu/precise/telepathy-mission-control-5/precise

« back to all changes in this revision

Viewing changes to test/twisted/account-manager/enable.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonny Lamb
  • Date: 2011-01-27 17:54:12 UTC
  • mto: (0.12.1 upstream) (7.1.4 maverick)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110127175412-cijhp5z0763s11cy
Tags: upstream-5.7.2
ImportĀ upstreamĀ versionĀ 5.7.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Nokia Corporation
2
 
# Copyright (C) 2009 Collabora Ltd.
3
 
#
4
 
# This library is free software; you can redistribute it and/or
5
 
# modify it under the terms of the GNU Lesser General Public
6
 
# License as published by the Free Software Foundation; either
7
 
# version 2.1 of the License, or (at your option) any later version.
8
 
#
9
 
# This library is distributed in the hope that it will be useful, but
10
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
 
# Lesser General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU Lesser General Public
15
 
# License along with this library; if not, write to the Free Software
16
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
 
# 02110-1301 USA
18
 
 
19
 
import dbus
20
 
import dbus
21
 
import dbus.service
22
 
 
23
 
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
24
 
        call_async
25
 
from mctest import exec_test, create_fakecm_account
26
 
import constants as cs
27
 
 
28
 
def test(q, bus, mc):
29
 
    params = dbus.Dictionary({"account": "smcv@example.com",
30
 
        "password": "secrecy"}, signature='sv')
31
 
    (cm_name_ref, account) = create_fakecm_account(q, bus, mc, params)
32
 
 
33
 
    account_iface = dbus.Interface(account, cs.ACCOUNT)
34
 
    account_props = dbus.Interface(account, cs.PROPERTIES_IFACE)
35
 
 
36
 
    call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
37
 
            (dbus.UInt32(cs.PRESENCE_TYPE_OFFLINE), 'offline', ''))
38
 
    q.expect('dbus-return', method='Set')
39
 
 
40
 
    call_async(q, account_props, 'Set', cs.ACCOUNT, 'Enabled', False)
41
 
    q.expect('dbus-return', method='Set')
42
 
 
43
 
    call_async(q, account_props, 'Set', cs.ACCOUNT, 'ConnectAutomatically',
44
 
            False)
45
 
    q.expect('dbus-return', method='Set')
46
 
 
47
 
    call_async(q, account_props, 'Set', cs.ACCOUNT, 'RequestedPresence',
48
 
            (dbus.UInt32(cs.PRESENCE_TYPE_BUSY), 'busy', 'Testing Enabled'))
49
 
    q.expect('dbus-return', method='Set')
50
 
 
51
 
    # Go online by setting Enabled
52
 
    call_async(q, account_props, 'Set', cs.ACCOUNT, 'Enabled', True)
53
 
 
54
 
    e = q.expect('dbus-method-call', method='RequestConnection',
55
 
            args=['fakeprotocol', params],
56
 
            destination=cs.tp_name_prefix + '.ConnectionManager.fakecm',
57
 
            path=cs.tp_path_prefix + '/ConnectionManager/fakecm',
58
 
            interface=cs.tp_name_prefix + '.ConnectionManager',
59
 
            handled=False)
60
 
 
61
 
if __name__ == '__main__':
62
 
    exec_test(test, {})