~nataliabidart/ubuntu-sso-client/rename-me-too

« back to all changes in this revision

Viewing changes to ubuntu_sso/tests/test_credentials.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2012-02-10 23:22:26 UTC
  • mfrom: (854.3.3 policy-url)
  • Revision ID: tarmac-20120210232226-1s3xdw4a4sf6dv2k
- Allow callers pass a 'policy_url' parameter to use in the UIs (LP: #930142).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import ubuntu_sso.main
25
25
 
26
26
from ubuntu_sso import credentials
27
 
from ubuntu_sso.credentials import (APP_NAME_KEY, HELP_TEXT_KEY,
28
 
    PING_URL_KEY, TC_URL_KEY, UI_EXECUTABLE_KEY, WINDOW_ID_KEY)
29
 
from ubuntu_sso.tests import (APP_NAME, EMAIL, GTK_GUI_EXE,
30
 
    HELP_TEXT, PASSWORD, PING_URL, TC_URL, TOKEN, WINDOW_ID)
 
27
from ubuntu_sso.credentials import (
 
28
    APP_NAME_KEY,
 
29
    HELP_TEXT_KEY,
 
30
    PING_URL_KEY,
 
31
    POLICY_URL_KEY,
 
32
    TC_URL_KEY,
 
33
    UI_EXECUTABLE_KEY,
 
34
    WINDOW_ID_KEY,
 
35
)
 
36
from ubuntu_sso.tests import (
 
37
    APP_NAME,
 
38
    EMAIL,
 
39
    GTK_GUI_EXE,
 
40
    HELP_TEXT,
 
41
    PASSWORD,
 
42
    PING_URL,
 
43
    POLICY_URL,
 
44
    TC_URL,
 
45
    TOKEN,
 
46
    WINDOW_ID,
 
47
)
31
48
 
32
49
 
33
50
# Access to a protected member of a client class
45
62
    HELP_TEXT_KEY: HELP_TEXT,
46
63
    WINDOW_ID_KEY: WINDOW_ID,
47
64
    PING_URL_KEY: PING_URL,
 
65
    POLICY_URL_KEY: POLICY_URL,
48
66
    TC_URL_KEY: TC_URL,
49
67
    UI_EXECUTABLE_KEY: 'foo-bar-baz',
50
68
}
53
71
    APP_NAME_KEY: APP_NAME,
54
72
    HELP_TEXT_KEY: HELP_TEXT,
55
73
    PING_URL_KEY: PING_URL,
 
74
    POLICY_URL_KEY: POLICY_URL,
56
75
    TC_URL_KEY: TC_URL,
57
76
    WINDOW_ID_KEY: WINDOW_ID,
58
77
}
145
164
 
146
165
        self.assertEqual(getattr(self.obj, PING_URL_KEY), None)
147
166
 
 
167
    def test_policy_url_defaults_to_none(self):
 
168
        """The policy url defaults to None."""
 
169
        newkw = KWARGS.copy()
 
170
        newkw.pop(POLICY_URL_KEY)
 
171
        self.obj = credentials.Credentials(**newkw)
 
172
 
 
173
        self.assertEqual(getattr(self.obj, POLICY_URL_KEY), None)
 
174
 
148
175
    def test_ui_executable_defaults_to_gtk(self):
149
176
        """The ui class defaults to gtk."""
150
177
        newkw = KWARGS.copy()
249
276
            '--app_name', APP_NAME,
250
277
            '--help_text', HELP_TEXT,
251
278
            '--ping_url', PING_URL,
 
279
            '--policy_url', POLICY_URL,
252
280
            '--tc_url', TC_URL,
253
281
            '--window_id', str(WINDOW_ID),
254
282
        ]