Merge lp:~nataliabidart/ubuntu-sso-client/policy-url into lp:ubuntu-sso-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 857
Merged at revision: 857
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/policy-url
Merge into: lp:ubuntu-sso-client
Prerequisite: lp:~nataliabidart/ubuntu-sso-client/run-that-ui
Diff against target: 237 lines (+75/-18)
6 files modified
ubuntu_sso/credentials.py (+6/-2)
ubuntu_sso/main/__init__.py (+2/-1)
ubuntu_sso/main/tests/test_common.py (+26/-5)
ubuntu_sso/qt/tests/show_gui.py (+8/-6)
ubuntu_sso/tests/__init__.py (+1/-0)
ubuntu_sso/tests/test_credentials.py (+32/-4)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/policy-url
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+92541@code.launchpad.net

Commit message

- Allow callers pass a 'policy_url' parameter to use in the UIs (LP: #930142).

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/credentials.py'
2--- ubuntu_sso/credentials.py 2012-02-10 17:49:09 +0000
3+++ ubuntu_sso/credentials.py 2012-02-10 17:49:09 +0000
4@@ -48,6 +48,7 @@
5 HELP_TEXT_KEY = 'help_text'
6 WINDOW_ID_KEY = 'window_id'
7 PING_URL_KEY = 'ping_url'
8+POLICY_URL_KEY = 'policy_url'
9 UI_EXECUTABLE_KEY = 'ui_executable'
10
11
12@@ -96,7 +97,7 @@
13 """Credentials management gateway."""
14
15 def __init__(self, app_name, tc_url=None, help_text='',
16- window_id=0, ping_url=None,
17+ window_id=0, ping_url=None, policy_url=None,
18 ui_executable='ubuntu-sso-login-gtk'):
19 """Return a Credentials management object.
20
21@@ -114,6 +115,8 @@
22 'ping_url' is the url that will be pinged when a user registers/logins
23 successfully. The user email will be attached to 'ping_url'.
24
25+ 'policy_url' is the url pointing to the privacy policy. If None, no
26+ privacy policy agreement will be displayed.
27
28 When the credentials are retrieved successfully, a dictionary like the
29 one below is returned:
30@@ -130,13 +133,14 @@
31 self.window_id = window_id
32 self.ping_url = ping_url
33 self.tc_url = tc_url
34+ self.policy_url = policy_url
35 self.ui_executable = ui_executable
36
37 @defer.inlineCallbacks
38 def _show_ui(self, login_only):
39 """Shows the UI, connect outcome signals."""
40 args = [str(self.ui_executable)]
41- for arg in ('app_name', 'help_text', 'ping_url',
42+ for arg in ('app_name', 'help_text', 'ping_url', 'policy_url',
43 'tc_url', 'window_id'):
44 value = getattr(self, arg)
45 if value:
46
47=== modified file 'ubuntu_sso/main/__init__.py'
48--- ubuntu_sso/main/__init__.py 2012-02-10 17:49:09 +0000
49+++ ubuntu_sso/main/__init__.py 2012-02-10 17:49:09 +0000
50@@ -31,6 +31,7 @@
51 Credentials,
52 HELP_TEXT_KEY,
53 PING_URL_KEY,
54+ POLICY_URL_KEY,
55 TC_URL_KEY,
56 UI_EXECUTABLE_KEY,
57 UserCancellationError,
58@@ -298,7 +299,7 @@
59 logger.info('Shutting down, calling %r.', self.shutdown_func)
60 self.shutdown_func()
61
62- valid_keys = (HELP_TEXT_KEY, PING_URL_KEY, TC_URL_KEY,
63+ valid_keys = (HELP_TEXT_KEY, PING_URL_KEY, POLICY_URL_KEY, TC_URL_KEY,
64 UI_EXECUTABLE_KEY, WINDOW_ID_KEY)
65
66 def _parse_args(self, args):
67
68=== modified file 'ubuntu_sso/main/tests/test_common.py'
69--- ubuntu_sso/main/tests/test_common.py 2012-02-10 17:49:09 +0000
70+++ ubuntu_sso/main/tests/test_common.py 2012-02-10 17:49:09 +0000
71@@ -30,12 +30,32 @@
72 TIMEOUT_INTERVAL,
73 UbuntuSSOService,
74 )
75-from ubuntu_sso.main import (HELP_TEXT_KEY, PING_URL_KEY,
76- TC_URL_KEY, UI_EXECUTABLE_KEY, WINDOW_ID_KEY)
77+from ubuntu_sso.main import (
78+ HELP_TEXT_KEY,
79+ PING_URL_KEY,
80+ POLICY_URL_KEY,
81+ TC_URL_KEY,
82+ UI_EXECUTABLE_KEY,
83+ WINDOW_ID_KEY,
84+)
85 from ubuntu_sso.main.tests import FakedCredentials
86-from ubuntu_sso.tests import (APP_NAME, TC_URL, HELP_TEXT, CAPTCHA_ID,
87- CAPTCHA_SOLUTION, EMAIL, EMAIL_TOKEN, NAME, PASSWORD, PING_URL, TOKEN,
88- WINDOW_ID, Recorder, TestCase)
89+from ubuntu_sso.tests import (
90+ APP_NAME,
91+ CAPTCHA_ID,
92+ CAPTCHA_SOLUTION,
93+ EMAIL,
94+ EMAIL_TOKEN,
95+ HELP_TEXT,
96+ NAME,
97+ PASSWORD,
98+ PING_URL,
99+ POLICY_URL,
100+ Recorder,
101+ TC_URL,
102+ TestCase,
103+ TOKEN,
104+ WINDOW_ID,
105+)
106
107
108 # Access to a protected member 'yyy' of a client class
109@@ -538,6 +558,7 @@
110
111 base_args = {
112 HELP_TEXT_KEY: HELP_TEXT, PING_URL_KEY: PING_URL,
113+ POLICY_URL_KEY: POLICY_URL,
114 TC_URL_KEY: TC_URL, WINDOW_ID_KEY: WINDOW_ID,
115 UI_EXECUTABLE_KEY: 'super-ui',
116 }
117
118=== modified file 'ubuntu_sso/qt/tests/show_gui.py'
119--- ubuntu_sso/qt/tests/show_gui.py 2012-02-10 17:49:09 +0000
120+++ ubuntu_sso/qt/tests/show_gui.py 2012-02-10 17:49:09 +0000
121@@ -30,9 +30,10 @@
122
123 from ubuntu_sso.main import get_sso_client
124 from ubuntu_sso.credentials import (
125+ HELP_TEXT_KEY,
126+ PING_URL_KEY,
127+ POLICY_URL_KEY,
128 TC_URL_KEY,
129- HELP_TEXT_KEY,
130- WINDOW_ID_KEY,
131 UI_EXECUTABLE_KEY,
132 )
133
134@@ -53,11 +54,12 @@
135 client.cred_manager.connect_to_signal('AuthorizationDenied', found)
136 client.cred_manager.connect_to_signal('CredentialsError', found)
137
138- yield client.cred_manager.login('Ubuntu Two',
139+ yield client.cred_manager.login(u'Ubuntu Two',
140 {
141- TC_URL_KEY: 'http://www.google.com',
142- HELP_TEXT_KEY: 'This is a test.',
143- WINDOW_ID_KEY: '0',
144+ HELP_TEXT_KEY: u'This is a test help text.',
145+ PING_URL_KEY: u'http://www.wikipedia.com/',
146+ POLICY_URL_KEY: u'http://one.ubuntu.com/',
147+ TC_URL_KEY: u'http://www.google.com/',
148 UI_EXECUTABLE_KEY: 'ubuntu-sso-login-gtk',
149 })
150 print "called ok"
151
152=== modified file 'ubuntu_sso/tests/__init__.py'
153--- ubuntu_sso/tests/__init__.py 2012-02-10 17:49:09 +0000
154+++ ubuntu_sso/tests/__init__.py 2012-02-10 17:49:09 +0000
155@@ -41,6 +41,7 @@
156 NAME = u'Juanito Pérez'
157 PASSWORD = u'h3lloWorld'
158 PING_URL = u'http://localhost/ping-me/'
159+POLICY_URL = u'http://localhost/policy/'
160 RESET_PASSWORD_TOKEN = u'8G5Wtq'
161 TOKEN = {u'consumer_key': u'xQ7xDAz',
162 u'consumer_secret': u'KzCJWCTNbbntwfyCKKjomJDzlgqxLy',
163
164=== modified file 'ubuntu_sso/tests/test_credentials.py'
165--- ubuntu_sso/tests/test_credentials.py 2012-02-10 17:49:09 +0000
166+++ ubuntu_sso/tests/test_credentials.py 2012-02-10 17:49:09 +0000
167@@ -24,10 +24,27 @@
168 import ubuntu_sso.main
169
170 from ubuntu_sso import credentials
171-from ubuntu_sso.credentials import (APP_NAME_KEY, HELP_TEXT_KEY,
172- PING_URL_KEY, TC_URL_KEY, UI_EXECUTABLE_KEY, WINDOW_ID_KEY)
173-from ubuntu_sso.tests import (APP_NAME, EMAIL, GTK_GUI_EXE,
174- HELP_TEXT, PASSWORD, PING_URL, TC_URL, TOKEN, WINDOW_ID)
175+from ubuntu_sso.credentials import (
176+ APP_NAME_KEY,
177+ HELP_TEXT_KEY,
178+ PING_URL_KEY,
179+ POLICY_URL_KEY,
180+ TC_URL_KEY,
181+ UI_EXECUTABLE_KEY,
182+ WINDOW_ID_KEY,
183+)
184+from ubuntu_sso.tests import (
185+ APP_NAME,
186+ EMAIL,
187+ GTK_GUI_EXE,
188+ HELP_TEXT,
189+ PASSWORD,
190+ PING_URL,
191+ POLICY_URL,
192+ TC_URL,
193+ TOKEN,
194+ WINDOW_ID,
195+)
196
197
198 # Access to a protected member of a client class
199@@ -45,6 +62,7 @@
200 HELP_TEXT_KEY: HELP_TEXT,
201 WINDOW_ID_KEY: WINDOW_ID,
202 PING_URL_KEY: PING_URL,
203+ POLICY_URL_KEY: POLICY_URL,
204 TC_URL_KEY: TC_URL,
205 UI_EXECUTABLE_KEY: 'foo-bar-baz',
206 }
207@@ -53,6 +71,7 @@
208 APP_NAME_KEY: APP_NAME,
209 HELP_TEXT_KEY: HELP_TEXT,
210 PING_URL_KEY: PING_URL,
211+ POLICY_URL_KEY: POLICY_URL,
212 TC_URL_KEY: TC_URL,
213 WINDOW_ID_KEY: WINDOW_ID,
214 }
215@@ -145,6 +164,14 @@
216
217 self.assertEqual(getattr(self.obj, PING_URL_KEY), None)
218
219+ def test_policy_url_defaults_to_none(self):
220+ """The policy url defaults to None."""
221+ newkw = KWARGS.copy()
222+ newkw.pop(POLICY_URL_KEY)
223+ self.obj = credentials.Credentials(**newkw)
224+
225+ self.assertEqual(getattr(self.obj, POLICY_URL_KEY), None)
226+
227 def test_ui_executable_defaults_to_gtk(self):
228 """The ui class defaults to gtk."""
229 newkw = KWARGS.copy()
230@@ -249,6 +276,7 @@
231 '--app_name', APP_NAME,
232 '--help_text', HELP_TEXT,
233 '--ping_url', PING_URL,
234+ '--policy_url', POLICY_URL,
235 '--tc_url', TC_URL,
236 '--window_id', str(WINDOW_ID),
237 ]

Subscribers

People subscribed via source and target branches