~mvo/ubuntu-sso-client/strawman-lp711413

630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
1
# -*- coding: utf-8 -*-
2
#
531 by natalia.bidart at canonical
Built correct structure.
3
# Copyright 2009 Canonical Ltd.
4
#
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
8
#
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with this program.  If not, see <http://www.gnu.org/licenses/>.
16
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
17
"""Tests for the Ubuntu SSO library."""
18
19
import os
20
667.1.1 by natalia.bidart at canonical
The service should shutdown when unused (LP: #701606).
21
from twisted.trial import unittest
22
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
23
from ubuntu_sso.keyring import get_token_name
24
637.3.3 by natalia.bidart at canonical
Started new Dbus interface.
25
APP_NAME = 'The Super App!'
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
26
CAPTCHA_ID = 'test'
27
CAPTCHA_PATH = os.path.abspath(os.path.join(os.curdir, 'ubuntu_sso', 'tests',
28
                                            'files', 'captcha.png'))
29
CAPTCHA_SOLUTION = 'william Byrd'
30
EMAIL = 'test@example.com'
31
EMAIL_TOKEN = 'B2Pgtf'
650.2.1 by Natalia B. Bidart
Splitting GUI code out of backend (LP: #677518).
32
GTK_GUI_CLASS = 'UbuntuSSOClientGUI'
33
GTK_GUI_MODULE = 'ubuntu_sso.gtk.gui'
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
34
HELP_TEXT = """Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sed
35
lorem nibh. Suspendisse gravida nulla non nunc suscipit pulvinar tempus ut
36
augue. Morbi consequat, ligula a elementum pretium, dolor nulla tempus metus,
37
sed viverra nisi risus non velit."""
38
NAME = 'Juanito PĂ©rez'
39
PASSWORD = 'h3lloWorld'
630.2.9 by natalia.bidart at canonical
Pinging done.
40
PING_URL = 'http://localhost/ping-me/'
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
41
RESET_PASSWORD_TOKEN = '8G5Wtq'
42
TOKEN = {u'consumer_key': u'xQ7xDAz',
43
         u'consumer_secret': u'KzCJWCTNbbntwfyCKKjomJDzlgqxLy',
44
         u'token_name': u'test',
45
         u'token': u'GkInOfSMGwTXAUoVQwLUoPxElEEUdhsLVNTPhxHJDUIeHCPNEo',
46
         u'token_secret': u'qFYImEtlczPbsCnYyuwLoPDlPEnvNcIktZphPQklAWrvyfFMV'}
47
TOKEN_NAME = get_token_name(APP_NAME)
630.2.9 by natalia.bidart at canonical
Pinging done.
48
TC_URL = 'http://localhost/'
630.2.1 by Natalia B. Bidart
Started refactor for expandible Dbus APIs.
49
WINDOW_ID = 5
667.1.1 by natalia.bidart at canonical
The service should shutdown when unused (LP: #701606).
50
51
52
class TestCase(unittest.TestCase):
53
    """Customized test case that keeps tracks of method calls."""
54
55
    def setUp(self):
56
        super(TestCase, self).setUp()
57
        self._called = False
58
59
    def _set_called(self, *args, **kwargs):
60
        """Keep track of a method call."""
61
        self._called = (args, kwargs)