Merge lp:~nataliabidart/ubuntu/maverick/ubuntu-sso-client/ubuntu-sso-client-1.0.9 into lp:ubuntu/maverick-proposed/ubuntu-sso-client
- Maverick (10.10)
- ubuntu-sso-client-1.0.9
- Merge into maverick-proposed
Proposed by
Natalia Bidart
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 21 | ||||
Proposed branch: | lp:~nataliabidart/ubuntu/maverick/ubuntu-sso-client/ubuntu-sso-client-1.0.9 | ||||
Merge into: | lp:ubuntu/maverick-proposed/ubuntu-sso-client | ||||
Diff against target: |
714 lines (+178/-258) 10 files modified
PKG-INFO (+1/-1) data/ui.glade (+40/-32) debian/changelog (+10/-0) po/ubuntu-sso-client.pot (+0/-179) run-tests (+1/-1) setup.py (+3/-2) ubuntu_sso/gui.py (+10/-12) ubuntu_sso/main.py (+33/-8) ubuntu_sso/tests/test_gui.py (+13/-18) ubuntu_sso/tests/test_main.py (+67/-5) |
||||
To merge this branch: | bzr merge lp:~nataliabidart/ubuntu/maverick/ubuntu-sso-client/ubuntu-sso-client-1.0.9 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Sponsors | Pending | ||
Review via email: mp+57380@code.launchpad.net |
Commit message
Description of the change
* New upstream release:
[ Natalia B. Bidart <email address hidden> ]
- Register now uses the 'displayname' field to pass it on to SSO as display name (LP: #709494).
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'PKG-INFO' | |||
2 | --- PKG-INFO 2010-12-16 13:19:01 +0000 | |||
3 | +++ PKG-INFO 2011-04-12 19:05:52 +0000 | |||
4 | @@ -1,6 +1,6 @@ | |||
5 | 1 | Metadata-Version: 1.1 | 1 | Metadata-Version: 1.1 |
6 | 2 | Name: ubuntu-sso-client | 2 | Name: ubuntu-sso-client |
8 | 3 | Version: 1.0.8 | 3 | Version: 1.0.9 |
9 | 4 | Summary: Ubuntu Single Sign-On client | 4 | Summary: Ubuntu Single Sign-On client |
10 | 5 | Home-page: https://launchpad.net/ubuntu-sso-client | 5 | Home-page: https://launchpad.net/ubuntu-sso-client |
11 | 6 | Author: Natalia Bidart | 6 | Author: Natalia Bidart |
12 | 7 | 7 | ||
13 | === modified file 'data/ui.glade' | |||
14 | --- data/ui.glade 2010-08-27 22:16:40 +0000 | |||
15 | +++ data/ui.glade 2011-04-12 19:05:52 +0000 | |||
16 | @@ -264,36 +264,62 @@ | |||
17 | 264 | </packing> | 264 | </packing> |
18 | 265 | </child> | 265 | </child> |
19 | 266 | <child> | 266 | <child> |
21 | 267 | <object class="GtkHButtonBox" id="hbuttonbox1"> | 267 | <object class="GtkHBox" id="hbox2"> |
22 | 268 | <property name="visible">True</property> | 268 | <property name="visible">True</property> |
23 | 269 | <property name="spacing">5</property> | ||
24 | 270 | <property name="layout_style">end</property> | ||
25 | 271 | <child> | 269 | <child> |
28 | 272 | <object class="GtkButton" id="join_cancel_button"> | 270 | <object class="GtkLinkButton" id="login_button"> |
29 | 273 | <property name="label">gtk-cancel</property> | 271 | <property name="label">login button</property> |
30 | 274 | <property name="visible">True</property> | 272 | <property name="visible">True</property> |
31 | 275 | <property name="can_focus">True</property> | 273 | <property name="can_focus">True</property> |
32 | 276 | <property name="receives_default">True</property> | 274 | <property name="receives_default">True</property> |
34 | 277 | <property name="use_stock">True</property> | 275 | <property name="relief">none</property> |
35 | 276 | <signal name="clicked" handler="on_sign_in_button_clicked" swapped="no"/> | ||
36 | 278 | </object> | 277 | </object> |
37 | 279 | <packing> | 278 | <packing> |
38 | 280 | <property name="expand">False</property> | 279 | <property name="expand">False</property> |
40 | 281 | <property name="fill">False</property> | 280 | <property name="fill">True</property> |
41 | 282 | <property name="position">0</property> | 281 | <property name="position">0</property> |
42 | 283 | </packing> | 282 | </packing> |
43 | 284 | </child> | 283 | </child> |
44 | 285 | <child> | 284 | <child> |
47 | 286 | <object class="GtkButton" id="join_ok_button"> | 285 | <object class="GtkHButtonBox" id="hbuttonbox1"> |
46 | 287 | <property name="label">gtk-go-forward</property> | ||
48 | 288 | <property name="visible">True</property> | 286 | <property name="visible">True</property> |
53 | 289 | <property name="can_focus">True</property> | 287 | <property name="can_focus">False</property> |
54 | 290 | <property name="receives_default">True</property> | 288 | <property name="spacing">5</property> |
55 | 291 | <property name="use_stock">True</property> | 289 | <property name="layout_style">end</property> |
56 | 292 | <signal name="clicked" handler="on_join_ok_button_clicked"/> | 290 | <child> |
57 | 291 | <object class="GtkButton" id="join_cancel_button"> | ||
58 | 292 | <property name="label">gtk-cancel</property> | ||
59 | 293 | <property name="visible">True</property> | ||
60 | 294 | <property name="can_focus">True</property> | ||
61 | 295 | <property name="receives_default">True</property> | ||
62 | 296 | <property name="use_stock">True</property> | ||
63 | 297 | </object> | ||
64 | 298 | <packing> | ||
65 | 299 | <property name="expand">False</property> | ||
66 | 300 | <property name="fill">False</property> | ||
67 | 301 | <property name="position">0</property> | ||
68 | 302 | </packing> | ||
69 | 303 | </child> | ||
70 | 304 | <child> | ||
71 | 305 | <object class="GtkButton" id="join_ok_button"> | ||
72 | 306 | <property name="label">gtk-go-forward</property> | ||
73 | 307 | <property name="visible">True</property> | ||
74 | 308 | <property name="can_focus">True</property> | ||
75 | 309 | <property name="receives_default">True</property> | ||
76 | 310 | <property name="use_stock">True</property> | ||
77 | 311 | <signal name="clicked" handler="on_join_ok_button_clicked" swapped="no"/> | ||
78 | 312 | </object> | ||
79 | 313 | <packing> | ||
80 | 314 | <property name="expand">False</property> | ||
81 | 315 | <property name="fill">False</property> | ||
82 | 316 | <property name="position">1</property> | ||
83 | 317 | </packing> | ||
84 | 318 | </child> | ||
85 | 293 | </object> | 319 | </object> |
86 | 294 | <packing> | 320 | <packing> |
87 | 295 | <property name="expand">False</property> | 321 | <property name="expand">False</property> |
89 | 296 | <property name="fill">False</property> | 322 | <property name="pack_type">end</property> |
90 | 297 | <property name="position">1</property> | 323 | <property name="position">1</property> |
91 | 298 | </packing> | 324 | </packing> |
92 | 299 | </child> | 325 | </child> |
93 | @@ -303,24 +329,6 @@ | |||
94 | 303 | <property name="position">12</property> | 329 | <property name="position">12</property> |
95 | 304 | </packing> | 330 | </packing> |
96 | 305 | </child> | 331 | </child> |
97 | 306 | <child> | ||
98 | 307 | <object class="GtkLinkButton" id="login_button"> | ||
99 | 308 | <property name="label" translatable="yes">login button</property> | ||
100 | 309 | <property name="visible">True</property> | ||
101 | 310 | <property name="can_focus">True</property> | ||
102 | 311 | <property name="receives_default">True</property> | ||
103 | 312 | <property name="has_tooltip">True</property> | ||
104 | 313 | <property name="relief">none</property> | ||
105 | 314 | <signal name="clicked" handler="on_sign_in_button_clicked"/> | ||
106 | 315 | </object> | ||
107 | 316 | <packing> | ||
108 | 317 | <property name="expand">False</property> | ||
109 | 318 | <property name="position">13</property> | ||
110 | 319 | </packing> | ||
111 | 320 | </child> | ||
112 | 321 | <child> | ||
113 | 322 | <placeholder/> | ||
114 | 323 | </child> | ||
115 | 324 | </object> | 332 | </object> |
116 | 325 | <object class="GtkVBox" id="processing_vbox"> | 333 | <object class="GtkVBox" id="processing_vbox"> |
117 | 326 | <property name="visible">True</property> | 334 | <property name="visible">True</property> |
118 | 327 | 335 | ||
119 | === modified file 'debian/changelog' | |||
120 | --- debian/changelog 2010-12-16 13:19:01 +0000 | |||
121 | +++ debian/changelog 2011-04-12 19:05:52 +0000 | |||
122 | @@ -1,3 +1,13 @@ | |||
123 | 1 | ubuntu-sso-client (1.0.9-0ubuntu1) UNRELEASED; urgency=low | ||
124 | 2 | |||
125 | 3 | * New upstream release: | ||
126 | 4 | |||
127 | 5 | [ Natalia B. Bidart <natalia.bidart@canonical.com> ] | ||
128 | 6 | - Register now uses the 'displayname' field to pass it on to SSO as | ||
129 | 7 | display name (LP: #709494). | ||
130 | 8 | |||
131 | 9 | -- Natalia Bidart (nessita) <nataliabidart@gmail.com> Tue, 29 Mar 2011 16:26:42 -0300 | ||
132 | 10 | |||
133 | 1 | ubuntu-sso-client (1.0.8-0ubuntu1) maverick-proposed; urgency=low | 11 | ubuntu-sso-client (1.0.8-0ubuntu1) maverick-proposed; urgency=low |
134 | 2 | 12 | ||
135 | 3 | * New upstream release. | 13 | * New upstream release. |
136 | 4 | 14 | ||
137 | === removed file 'po/ubuntu-sso-client.pot' | |||
138 | --- po/ubuntu-sso-client.pot 2010-12-16 13:19:01 +0000 | |||
139 | +++ po/ubuntu-sso-client.pot 1970-01-01 00:00:00 +0000 | |||
140 | @@ -1,179 +0,0 @@ | |||
141 | 1 | # SOME DESCRIPTIVE TITLE. | ||
142 | 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | ||
143 | 3 | # This file is distributed under the same license as the PACKAGE package. | ||
144 | 4 | # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
145 | 5 | # | ||
146 | 6 | #, fuzzy | ||
147 | 7 | msgid "" | ||
148 | 8 | msgstr "" | ||
149 | 9 | "Project-Id-Version: PACKAGE VERSION\n" | ||
150 | 10 | "Report-Msgid-Bugs-To: \n" | ||
151 | 11 | "POT-Creation-Date: 2010-12-16 12:42-0300\n" | ||
152 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
153 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
154 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ||
155 | 15 | "Language: \n" | ||
156 | 16 | "MIME-Version: 1.0\n" | ||
157 | 17 | "Content-Type: text/plain; charset=CHARSET\n" | ||
158 | 18 | "Content-Transfer-Encoding: 8bit\n" | ||
159 | 19 | |||
160 | 20 | #: ../ubuntu_sso/gui.py:189 | ||
161 | 21 | msgid "Type the characters above" | ||
162 | 22 | msgstr "" | ||
163 | 23 | |||
164 | 24 | #: ../ubuntu_sso/gui.py:190 | ||
165 | 25 | #, python-format | ||
166 | 26 | msgid "To connect this computer to %(app_name)s enter your details below." | ||
167 | 27 | msgstr "" | ||
168 | 28 | |||
169 | 29 | #: ../ubuntu_sso/gui.py:192 ../ubuntu_sso/gui.py:203 ../ubuntu_sso/gui.py:221 | ||
170 | 30 | msgid "Email address" | ||
171 | 31 | msgstr "" | ||
172 | 32 | |||
173 | 33 | #: ../ubuntu_sso/gui.py:193 | ||
174 | 34 | msgid "Re-type Email address" | ||
175 | 35 | msgstr "" | ||
176 | 36 | |||
177 | 37 | #: ../ubuntu_sso/gui.py:194 | ||
178 | 38 | msgid "" | ||
179 | 39 | "The email addresses don't match, please double check and try entering them " | ||
180 | 40 | "again." | ||
181 | 41 | msgstr "" | ||
182 | 42 | |||
183 | 43 | #: ../ubuntu_sso/gui.py:196 | ||
184 | 44 | msgid "The email must be a valid email address." | ||
185 | 45 | msgstr "" | ||
186 | 46 | |||
187 | 47 | #: ../ubuntu_sso/gui.py:197 | ||
188 | 48 | msgid "Enter code verification here" | ||
189 | 49 | msgstr "" | ||
190 | 50 | |||
191 | 51 | #: ../ubuntu_sso/gui.py:198 | ||
192 | 52 | msgid "This field is required." | ||
193 | 53 | msgstr "" | ||
194 | 54 | |||
195 | 55 | #: ../ubuntu_sso/gui.py:199 | ||
196 | 56 | msgid "I've forgotten my password" | ||
197 | 57 | msgstr "" | ||
198 | 58 | |||
199 | 59 | #: ../ubuntu_sso/gui.py:200 | ||
200 | 60 | #, python-format | ||
201 | 61 | msgid "Create %(app_name)s account" | ||
202 | 62 | msgstr "" | ||
203 | 63 | |||
204 | 64 | #: ../ubuntu_sso/gui.py:201 | ||
205 | 65 | msgid "Loading..." | ||
206 | 66 | msgstr "" | ||
207 | 67 | |||
208 | 68 | #: ../ubuntu_sso/gui.py:202 | ||
209 | 69 | msgid "Already have an account? Click here to sign in" | ||
210 | 70 | msgstr "" | ||
211 | 71 | |||
212 | 72 | #: ../ubuntu_sso/gui.py:204 | ||
213 | 73 | #, python-format | ||
214 | 74 | msgid "Connect to %(app_name)s" | ||
215 | 75 | msgstr "" | ||
216 | 76 | |||
217 | 77 | #: ../ubuntu_sso/gui.py:205 ../ubuntu_sso/gui.py:210 | ||
218 | 78 | msgid "Password" | ||
219 | 79 | msgstr "" | ||
220 | 80 | |||
221 | 81 | #: ../ubuntu_sso/gui.py:206 | ||
222 | 82 | msgid "Name" | ||
223 | 83 | msgstr "" | ||
224 | 84 | |||
225 | 85 | #: ../ubuntu_sso/gui.py:207 | ||
226 | 86 | msgid "Next" | ||
227 | 87 | msgstr "" | ||
228 | 88 | |||
229 | 89 | #: ../ubuntu_sso/gui.py:208 | ||
230 | 90 | msgid "One moment please..." | ||
231 | 91 | msgstr "" | ||
232 | 92 | |||
233 | 93 | #: ../ubuntu_sso/gui.py:209 | ||
234 | 94 | msgid "Your password was successfully changed." | ||
235 | 95 | msgstr "" | ||
236 | 96 | |||
237 | 97 | #: ../ubuntu_sso/gui.py:211 | ||
238 | 98 | msgid "Re-type Password" | ||
239 | 99 | msgstr "" | ||
240 | 100 | |||
241 | 101 | #: ../ubuntu_sso/gui.py:212 | ||
242 | 102 | msgid "" | ||
243 | 103 | "The password must have a minimum of 8 characters and include one uppercase " | ||
244 | 104 | "character and one number." | ||
245 | 105 | msgstr "" | ||
246 | 106 | |||
247 | 107 | #: ../ubuntu_sso/gui.py:214 | ||
248 | 108 | msgid "" | ||
249 | 109 | "The passwords don't match, please double check and try entering them again." | ||
250 | 110 | msgstr "" | ||
251 | 111 | |||
252 | 112 | #: ../ubuntu_sso/gui.py:216 | ||
253 | 113 | msgid "The password is too weak." | ||
254 | 114 | msgstr "" | ||
255 | 115 | |||
256 | 116 | #: ../ubuntu_sso/gui.py:217 | ||
257 | 117 | #, python-format | ||
258 | 118 | msgid "To reset your %(app_name)s password, enter your email address below:" | ||
259 | 119 | msgstr "" | ||
260 | 120 | |||
261 | 121 | #: ../ubuntu_sso/gui.py:219 | ||
262 | 122 | msgid "Reset password" | ||
263 | 123 | msgstr "" | ||
264 | 124 | |||
265 | 125 | #: ../ubuntu_sso/gui.py:220 | ||
266 | 126 | msgid "Reset code" | ||
267 | 127 | msgstr "" | ||
268 | 128 | |||
269 | 129 | #: ../ubuntu_sso/gui.py:222 | ||
270 | 130 | #, python-format | ||
271 | 131 | msgid "" | ||
272 | 132 | "A password reset code has been sent to %(email)s.\n" | ||
273 | 133 | "Please enter the code below along with your new password." | ||
274 | 134 | msgstr "" | ||
275 | 135 | |||
276 | 136 | #: ../ubuntu_sso/gui.py:225 | ||
277 | 137 | msgid "The process finished successfully. Congratulations!" | ||
278 | 138 | msgstr "" | ||
279 | 139 | |||
280 | 140 | #: ../ubuntu_sso/gui.py:226 | ||
281 | 141 | msgid "Terms & Conditions" | ||
282 | 142 | msgstr "" | ||
283 | 143 | |||
284 | 144 | #: ../ubuntu_sso/gui.py:227 | ||
285 | 145 | msgid "Agreeing to the Ubuntu One Terms & Conditions is required to subscribe." | ||
286 | 146 | msgstr "" | ||
287 | 147 | |||
288 | 148 | #: ../ubuntu_sso/gui.py:229 | ||
289 | 149 | msgid "" | ||
290 | 150 | "There was an error when trying to complete the process. Please check the " | ||
291 | 151 | "information and try again." | ||
292 | 152 | msgstr "" | ||
293 | 153 | |||
294 | 154 | #: ../ubuntu_sso/gui.py:231 | ||
295 | 155 | msgid "Enter verification code" | ||
296 | 156 | msgstr "" | ||
297 | 157 | |||
298 | 158 | #: ../ubuntu_sso/gui.py:232 | ||
299 | 159 | #, python-format | ||
300 | 160 | msgid "" | ||
301 | 161 | "Check %(email)s for an email from Ubuntu Single Sign On. This message " | ||
302 | 162 | "contains a verification code. Enter the code in the field below and click OK " | ||
303 | 163 | "to complete creating your %(app_name)s account" | ||
304 | 164 | msgstr "" | ||
305 | 165 | |||
306 | 166 | #: ../ubuntu_sso/gui.py:237 | ||
307 | 167 | #, python-format | ||
308 | 168 | msgid "I agree with the %(app_name)s " | ||
309 | 169 | msgstr "" | ||
310 | 170 | |||
311 | 171 | #. Terms&Conditions button | ||
312 | 172 | #: ../ubuntu_sso/gui.py:238 | ||
313 | 173 | #, python-format | ||
314 | 174 | msgid "Yes! Email me %(app_name)s tips and updates." | ||
315 | 175 | msgstr "" | ||
316 | 176 | |||
317 | 177 | #: ../ubuntu_sso/gui.py:239 | ||
318 | 178 | msgid "Reload" | ||
319 | 179 | msgstr "" | ||
320 | 180 | 0 | ||
321 | === modified file 'run-tests' | |||
322 | --- run-tests 2010-09-08 19:25:02 +0000 | |||
323 | +++ run-tests 2011-04-12 19:05:52 +0000 | |||
324 | @@ -16,7 +16,7 @@ | |||
325 | 16 | # with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
326 | 17 | 17 | ||
327 | 18 | `which xvfb-run` ./contrib/test "$@" | 18 | `which xvfb-run` ./contrib/test "$@" |
329 | 19 | pylint contrib ubuntu_sso | 19 | pylint ubuntu_sso |
330 | 20 | if [ -x `which pep8` ]; then | 20 | if [ -x `which pep8` ]; then |
331 | 21 | pep8 --repeat bin/ contrib/ ubuntu_sso/ | 21 | pep8 --repeat bin/ contrib/ ubuntu_sso/ |
332 | 22 | else | 22 | else |
333 | 23 | 23 | ||
334 | === modified file 'setup.py' | |||
335 | --- setup.py 2010-12-16 13:19:01 +0000 | |||
336 | +++ setup.py 2011-04-12 19:05:52 +0000 | |||
337 | @@ -36,7 +36,8 @@ | |||
338 | 36 | from distutils.command import clean, build | 36 | from distutils.command import clean, build |
339 | 37 | 37 | ||
340 | 38 | # Defining variables for various rules here, similar to a Makefile.am | 38 | # Defining variables for various rules here, similar to a Makefile.am |
342 | 39 | CLEANFILES = ['data/com.ubuntu.sso.service'] | 39 | CLEANFILES = ['data/com.ubuntu.sso.service', 'po/ubuntu-sso-client.pot', |
343 | 40 | 'MANIFEST'] | ||
344 | 40 | 41 | ||
345 | 41 | 42 | ||
346 | 42 | # XXX: This needs some serious cleanup | 43 | # XXX: This needs some serious cleanup |
347 | @@ -86,7 +87,7 @@ | |||
348 | 86 | 87 | ||
349 | 87 | DistUtilsExtra.auto.setup( | 88 | DistUtilsExtra.auto.setup( |
350 | 88 | name='ubuntu-sso-client', | 89 | name='ubuntu-sso-client', |
352 | 89 | version='1.0.8', | 90 | version='1.0.9', |
353 | 90 | license='GPL v3', | 91 | license='GPL v3', |
354 | 91 | author='Natalia Bidart', | 92 | author='Natalia Bidart', |
355 | 92 | author_email='natalia.bidart@canonical.com', | 93 | author_email='natalia.bidart@canonical.com', |
356 | 93 | 94 | ||
357 | === modified file 'ubuntu_sso/gui.py' | |||
358 | --- ubuntu_sso/gui.py 2010-12-16 13:19:01 +0000 | |||
359 | +++ ubuntu_sso/gui.py 2011-04-12 19:05:52 +0000 | |||
360 | @@ -387,8 +387,6 @@ | |||
361 | 387 | msg = 'UbuntuSSOClientGUI: failed set_transient_for win id %r' | 387 | msg = 'UbuntuSSOClientGUI: failed set_transient_for win id %r' |
362 | 388 | logger.exception(msg, window_id) | 388 | logger.exception(msg, window_id) |
363 | 389 | 389 | ||
364 | 390 | # Hidding unused widgets to save some space (LP #627440). | ||
365 | 391 | self.name_entry.hide() | ||
366 | 392 | self.yes_to_updates_checkbutton.hide() | 390 | self.yes_to_updates_checkbutton.hide() |
367 | 393 | 391 | ||
368 | 394 | self.window.show() | 392 | self.window.show() |
369 | @@ -769,11 +767,10 @@ | |||
370 | 769 | 767 | ||
371 | 770 | error = False | 768 | error = False |
372 | 771 | 769 | ||
378 | 772 | # Hidding unused widgets to save some space (LP #627440). | 770 | name = self.name_entry.get_text() |
379 | 773 | #name = self.name_entry.get_text() | 771 | if not name: |
380 | 774 | #if not name: | 772 | self.name_entry.set_warning(self.FIELD_REQUIRED) |
381 | 775 | # self.name_entry.set_warning(self.FIELD_REQUIRED) | 773 | error = True |
377 | 776 | # error = True | ||
382 | 777 | 774 | ||
383 | 778 | # check email | 775 | # check email |
384 | 779 | email1 = self.email1_entry.get_text() | 776 | email1 = self.email1_entry.get_text() |
385 | @@ -811,11 +808,12 @@ | |||
386 | 811 | self.user_email = email1 | 808 | self.user_email = email1 |
387 | 812 | self.user_password = password1 | 809 | self.user_password = password1 |
388 | 813 | 810 | ||
394 | 814 | logger.info('Calling register_user with email %r, password <hidden>,' \ | 811 | logger.info('Calling register_with_name with email %r, password, ' |
395 | 815 | ' captcha_id %r and captcha_solution %r.', email1, | 812 | '<hidden> name %r, captcha_id %r and captcha_solution %r.', |
396 | 816 | self._captcha_id, captcha_solution) | 813 | email1, name, self._captcha_id, captcha_solution) |
397 | 817 | f = self.backend.register_user | 814 | f = self.backend.register_with_name |
398 | 818 | f(self.app_name, email1, password1, self._captcha_id, captcha_solution, | 815 | f(self.app_name, email1, password1, name, |
399 | 816 | self._captcha_id, captcha_solution, | ||
400 | 819 | reply_handler=NO_OP, error_handler=NO_OP) | 817 | reply_handler=NO_OP, error_handler=NO_OP) |
401 | 820 | 818 | ||
402 | 821 | def on_tc_button_clicked(self, *args, **kwargs): | 819 | def on_tc_button_clicked(self, *args, **kwargs): |
403 | 822 | 820 | ||
404 | === modified file 'ubuntu_sso/main.py' | |||
405 | --- ubuntu_sso/main.py 2010-12-16 13:19:01 +0000 | |||
406 | +++ ubuntu_sso/main.py 2011-04-12 19:05:52 +0000 | |||
407 | @@ -171,24 +171,27 @@ | |||
408 | 171 | 171 | ||
409 | 172 | return captcha['captcha_id'] | 172 | return captcha['captcha_id'] |
410 | 173 | 173 | ||
412 | 174 | def register_user(self, email, password, captcha_id, captcha_solution): | 174 | def register_with_name(self, email, password, displayname, |
413 | 175 | captcha_id, captcha_solution): | ||
414 | 175 | """Register a new user with 'email' and 'password'.""" | 176 | """Register a new user with 'email' and 'password'.""" |
418 | 176 | logger.debug('register_user: email: %r password: <hidden>, ' | 177 | logger.debug('register_with_name: email: %r password: <hidden>, ' |
419 | 177 | 'captcha_id: %r, captcha_solution: %r', | 178 | 'displayname: %r, captcha_id: %r, captcha_solution: %r', |
420 | 178 | email, captcha_id, captcha_solution) | 179 | email, displayname, captcha_id, captcha_solution) |
421 | 179 | sso_service = self.sso_service_class(None, self.service_url) | 180 | sso_service = self.sso_service_class(None, self.service_url) |
422 | 180 | if not self._valid_email(email): | 181 | if not self._valid_email(email): |
424 | 181 | logger.error('register_user: InvalidEmailError for email: %r', | 182 | logger.error('register_with_name: InvalidEmailError for email: %r', |
425 | 182 | email) | 183 | email) |
426 | 183 | raise InvalidEmailError() | 184 | raise InvalidEmailError() |
427 | 184 | if not self._valid_password(password): | 185 | if not self._valid_password(password): |
429 | 185 | logger.error('register_user: InvalidPasswordError') | 186 | logger.error('register_with_name: InvalidPasswordError') |
430 | 186 | raise InvalidPasswordError() | 187 | raise InvalidPasswordError() |
431 | 187 | 188 | ||
432 | 188 | result = sso_service.registrations.register( | 189 | result = sso_service.registrations.register( |
434 | 189 | email=email, password=password, captcha_id=captcha_id, | 190 | email=email, password=password, |
435 | 191 | displayname=displayname, | ||
436 | 192 | captcha_id=captcha_id, | ||
437 | 190 | captcha_solution=captcha_solution) | 193 | captcha_solution=captcha_solution) |
439 | 191 | logger.info('register_user: email: %r result: %r', email, result) | 194 | logger.info('register_with_name: email: %r result: %r', email, result) |
440 | 192 | 195 | ||
441 | 193 | if result['status'] == 'error': | 196 | if result['status'] == 'error': |
442 | 194 | errorsdict = self._format_webservice_errors(result['errors']) | 197 | errorsdict = self._format_webservice_errors(result['errors']) |
443 | @@ -198,6 +201,17 @@ | |||
444 | 198 | else: | 201 | else: |
445 | 199 | return email | 202 | return email |
446 | 200 | 203 | ||
447 | 204 | def register_user(self, email, password, | ||
448 | 205 | captcha_id, captcha_solution): | ||
449 | 206 | """Register a new user with 'email' and 'password'.""" | ||
450 | 207 | logger.debug('register_user: email: %r password: <hidden>, ' | ||
451 | 208 | 'captcha_id: %r, captcha_solution: %r', | ||
452 | 209 | email, captcha_id, captcha_solution) | ||
453 | 210 | res = self.register_with_name(email, password, displayname='', | ||
454 | 211 | captcha_id=captcha_id, | ||
455 | 212 | captcha_solution=captcha_solution) | ||
456 | 213 | return res | ||
457 | 214 | |||
458 | 201 | def login(self, email, password, token_name): | 215 | def login(self, email, password, token_name): |
459 | 202 | """Login a user with 'email' and 'password'.""" | 216 | """Login a user with 'email' and 'password'.""" |
460 | 203 | logger.debug('login: email: %r password: <hidden>, token_name: %r', | 217 | logger.debug('login: email: %r password: <hidden>, token_name: %r', |
461 | @@ -387,6 +401,17 @@ | |||
462 | 387 | captcha_id, captcha_solution) | 401 | captcha_id, captcha_solution) |
463 | 388 | blocking(f, app_name, self.UserRegistered, self.UserRegistrationError) | 402 | blocking(f, app_name, self.UserRegistered, self.UserRegistrationError) |
464 | 389 | 403 | ||
465 | 404 | @dbus.service.method(dbus_interface=DBUS_IFACE_USER_NAME, | ||
466 | 405 | in_signature='ssssss') | ||
467 | 406 | def register_with_name(self, app_name, email, password, name, | ||
468 | 407 | captcha_id, captcha_solution): | ||
469 | 408 | """Call the matching method in the processor.""" | ||
470 | 409 | def f(): | ||
471 | 410 | """Inner function that will be run in a thread.""" | ||
472 | 411 | return self.processor.register_with_name(email, password, name, | ||
473 | 412 | captcha_id, captcha_solution) | ||
474 | 413 | blocking(f, app_name, self.UserRegistered, self.UserRegistrationError) | ||
475 | 414 | |||
476 | 390 | # login signals | 415 | # login signals |
477 | 391 | @dbus.service.signal(DBUS_IFACE_USER_NAME, signature="ss") | 416 | @dbus.service.signal(DBUS_IFACE_USER_NAME, signature="ss") |
478 | 392 | def LoggedIn(self, app_name, result): | 417 | def LoggedIn(self, app_name, result): |
479 | 393 | 418 | ||
480 | === modified file 'ubuntu_sso/tests/test_gui.py' | |||
481 | --- ubuntu_sso/tests/test_gui.py 2010-11-04 12:20:56 +0000 | |||
482 | +++ ubuntu_sso/tests/test_gui.py 2011-04-12 19:05:52 +0000 | |||
483 | @@ -63,7 +63,7 @@ | |||
484 | 63 | self._args = args | 63 | self._args = args |
485 | 64 | self._kwargs = kwargs | 64 | self._kwargs = kwargs |
486 | 65 | self._called = {} | 65 | self._called = {} |
488 | 66 | for i in ('generate_captcha', 'login', 'register_user', | 66 | for i in ('generate_captcha', 'login', 'register_with_name', |
489 | 67 | 'validate_email', 'request_password_reset_token', | 67 | 'validate_email', 'request_password_reset_token', |
490 | 68 | 'set_new_password'): | 68 | 'set_new_password'): |
491 | 69 | setattr(self, i, self._record_call(i)) | 69 | setattr(self, i, self._record_call(i)) |
492 | @@ -674,11 +674,11 @@ | |||
493 | 674 | """Clicking 'join_ok_button' sends info to backend using 'register'.""" | 674 | """Clicking 'join_ok_button' sends info to backend using 'register'.""" |
494 | 675 | self.click_join_with_valid_data() | 675 | self.click_join_with_valid_data() |
495 | 676 | 676 | ||
498 | 677 | # assert register_user was called | 677 | # assert register_with_name was called |
499 | 678 | expected = 'register_user' | 678 | expected = 'register_with_name' |
500 | 679 | self.assertIn(expected, self.ui.backend._called) | 679 | self.assertIn(expected, self.ui.backend._called) |
501 | 680 | self.assertEqual(self.ui.backend._called[expected], | 680 | self.assertEqual(self.ui.backend._called[expected], |
503 | 681 | ((APP_NAME, EMAIL, PASSWORD, CAPTCHA_ID, | 681 | ((APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID, |
504 | 682 | CAPTCHA_SOLUTION), | 682 | CAPTCHA_SOLUTION), |
505 | 683 | dict(reply_handler=gui.NO_OP, | 683 | dict(reply_handler=gui.NO_OP, |
506 | 684 | error_handler=gui.NO_OP))) | 684 | error_handler=gui.NO_OP))) |
507 | @@ -1161,12 +1161,7 @@ | |||
508 | 1161 | 1161 | ||
509 | 1162 | self.assert_correct_entry_warning(self.ui.name_entry, | 1162 | self.assert_correct_entry_warning(self.ui.name_entry, |
510 | 1163 | self.ui.FIELD_REQUIRED) | 1163 | self.ui.FIELD_REQUIRED) |
517 | 1164 | self.assertNotIn('register_user', self.ui.backend._called) | 1164 | self.assertNotIn('register_with_name', self.ui.backend._called) |
512 | 1165 | |||
513 | 1166 | # Unused variable 'skip' | ||
514 | 1167 | # pylint: disable=W0612 | ||
515 | 1168 | test_warning_is_shown_if_name_empty.skip = \ | ||
516 | 1169 | 'Unused for now, will be hidden to save space (LP: #627440).' | ||
518 | 1170 | 1165 | ||
519 | 1171 | def test_warning_is_shown_if_empty_email(self): | 1166 | def test_warning_is_shown_if_empty_email(self): |
520 | 1172 | """A warning message is shown if emails are empty.""" | 1167 | """A warning message is shown if emails are empty.""" |
521 | @@ -1179,7 +1174,7 @@ | |||
522 | 1179 | self.ui.FIELD_REQUIRED) | 1174 | self.ui.FIELD_REQUIRED) |
523 | 1180 | self.assert_correct_entry_warning(self.ui.email2_entry, | 1175 | self.assert_correct_entry_warning(self.ui.email2_entry, |
524 | 1181 | self.ui.FIELD_REQUIRED) | 1176 | self.ui.FIELD_REQUIRED) |
526 | 1182 | self.assertNotIn('register_user', self.ui.backend._called) | 1177 | self.assertNotIn('register_with_name', self.ui.backend._called) |
527 | 1183 | 1178 | ||
528 | 1184 | def test_warning_is_shown_if_email_mismatch(self): | 1179 | def test_warning_is_shown_if_email_mismatch(self): |
529 | 1185 | """A warning message is shown if emails doesn't match.""" | 1180 | """A warning message is shown if emails doesn't match.""" |
530 | @@ -1192,7 +1187,7 @@ | |||
531 | 1192 | self.ui.EMAIL_MISMATCH) | 1187 | self.ui.EMAIL_MISMATCH) |
532 | 1193 | self.assert_correct_entry_warning(self.ui.email2_entry, | 1188 | self.assert_correct_entry_warning(self.ui.email2_entry, |
533 | 1194 | self.ui.EMAIL_MISMATCH) | 1189 | self.ui.EMAIL_MISMATCH) |
535 | 1195 | self.assertNotIn('register_user', self.ui.backend._called) | 1190 | self.assertNotIn('register_with_name', self.ui.backend._called) |
536 | 1196 | 1191 | ||
537 | 1197 | def test_warning_is_shown_if_invalid_email(self): | 1192 | def test_warning_is_shown_if_invalid_email(self): |
538 | 1198 | """A warning message is shown if email is invalid.""" | 1193 | """A warning message is shown if email is invalid.""" |
539 | @@ -1205,7 +1200,7 @@ | |||
540 | 1205 | self.ui.EMAIL_INVALID) | 1200 | self.ui.EMAIL_INVALID) |
541 | 1206 | self.assert_correct_entry_warning(self.ui.email2_entry, | 1201 | self.assert_correct_entry_warning(self.ui.email2_entry, |
542 | 1207 | self.ui.EMAIL_INVALID) | 1202 | self.ui.EMAIL_INVALID) |
544 | 1208 | self.assertNotIn('register_user', self.ui.backend._called) | 1203 | self.assertNotIn('register_with_name', self.ui.backend._called) |
545 | 1209 | 1204 | ||
546 | 1210 | def test_password_help_is_always_shown(self): | 1205 | def test_password_help_is_always_shown(self): |
547 | 1211 | """Password help text is correctly displayed.""" | 1206 | """Password help text is correctly displayed.""" |
548 | @@ -1213,7 +1208,7 @@ | |||
549 | 1213 | 'password help text is visible.') | 1208 | 'password help text is visible.') |
550 | 1214 | self.assertEqual(self.ui.password_help_label.get_text(), | 1209 | self.assertEqual(self.ui.password_help_label.get_text(), |
551 | 1215 | self.ui.PASSWORD_HELP) | 1210 | self.ui.PASSWORD_HELP) |
553 | 1216 | self.assertNotIn('register_user', self.ui.backend._called) | 1211 | self.assertNotIn('register_with_name', self.ui.backend._called) |
554 | 1217 | 1212 | ||
555 | 1218 | def test_warning_is_shown_if_password_mismatch(self): | 1213 | def test_warning_is_shown_if_password_mismatch(self): |
556 | 1219 | """A warning message is shown if password doesn't match.""" | 1214 | """A warning message is shown if password doesn't match.""" |
557 | @@ -1226,7 +1221,7 @@ | |||
558 | 1226 | self.ui.PASSWORD_MISMATCH) | 1221 | self.ui.PASSWORD_MISMATCH) |
559 | 1227 | self.assert_correct_entry_warning(self.ui.password2_entry, | 1222 | self.assert_correct_entry_warning(self.ui.password2_entry, |
560 | 1228 | self.ui.PASSWORD_MISMATCH) | 1223 | self.ui.PASSWORD_MISMATCH) |
562 | 1229 | self.assertNotIn('register_user', self.ui.backend._called) | 1224 | self.assertNotIn('register_with_name', self.ui.backend._called) |
563 | 1230 | 1225 | ||
564 | 1231 | def test_warning_is_shown_if_password_too_weak(self): | 1226 | def test_warning_is_shown_if_password_too_weak(self): |
565 | 1232 | """A warning message is shown if password is too weak.""" | 1227 | """A warning message is shown if password is too weak.""" |
566 | @@ -1241,7 +1236,7 @@ | |||
567 | 1241 | self.ui.PASSWORD_TOO_WEAK) | 1236 | self.ui.PASSWORD_TOO_WEAK) |
568 | 1242 | self.assert_correct_entry_warning(self.ui.password2_entry, | 1237 | self.assert_correct_entry_warning(self.ui.password2_entry, |
569 | 1243 | self.ui.PASSWORD_TOO_WEAK) | 1238 | self.ui.PASSWORD_TOO_WEAK) |
571 | 1244 | self.assertNotIn('register_user', self.ui.backend._called) | 1239 | self.assertNotIn('register_with_name', self.ui.backend._called) |
572 | 1245 | 1240 | ||
573 | 1246 | def test_warning_is_shown_if_tc_not_accepted(self): | 1241 | def test_warning_is_shown_if_tc_not_accepted(self): |
574 | 1247 | """A warning message is shown if TC are not accepted.""" | 1242 | """A warning message is shown if TC are not accepted.""" |
575 | @@ -1252,7 +1247,7 @@ | |||
576 | 1252 | 1247 | ||
577 | 1253 | self.assert_correct_label_warning(self.ui.tc_warning_label, | 1248 | self.assert_correct_label_warning(self.ui.tc_warning_label, |
578 | 1254 | self.ui.TC_NOT_ACCEPTED) | 1249 | self.ui.TC_NOT_ACCEPTED) |
580 | 1255 | self.assertNotIn('register_user', self.ui.backend._called) | 1250 | self.assertNotIn('register_with_name', self.ui.backend._called) |
581 | 1256 | 1251 | ||
582 | 1257 | def test_warning_is_shown_if_not_captcha_solution(self): | 1252 | def test_warning_is_shown_if_not_captcha_solution(self): |
583 | 1258 | """A warning message is shown if TC are not accepted.""" | 1253 | """A warning message is shown if TC are not accepted.""" |
584 | @@ -1263,7 +1258,7 @@ | |||
585 | 1263 | 1258 | ||
586 | 1264 | self.assert_correct_entry_warning(self.ui.captcha_solution_entry, | 1259 | self.assert_correct_entry_warning(self.ui.captcha_solution_entry, |
587 | 1265 | self.ui.FIELD_REQUIRED) | 1260 | self.ui.FIELD_REQUIRED) |
589 | 1266 | self.assertNotIn('register_user', self.ui.backend._called) | 1261 | self.assertNotIn('register_with_name', self.ui.backend._called) |
590 | 1267 | 1262 | ||
591 | 1268 | def test_no_warning_messages_if_valid_data(self): | 1263 | def test_no_warning_messages_if_valid_data(self): |
592 | 1269 | """No warning messages are shown if the data is valid.""" | 1264 | """No warning messages are shown if the data is valid.""" |
593 | 1270 | 1265 | ||
594 | === modified file 'ubuntu_sso/tests/test_main.py' | |||
595 | --- ubuntu_sso/tests/test_main.py 2010-12-16 13:19:01 +0000 | |||
596 | +++ ubuntu_sso/tests/test_main.py 2011-04-12 19:05:52 +0000 | |||
597 | @@ -1,3 +1,5 @@ | |||
598 | 1 | # -*- coding: utf-8 -*- | ||
599 | 2 | # | ||
600 | 1 | # test_main - tests for ubuntu_sso.main | 3 | # test_main - tests for ubuntu_sso.main |
601 | 2 | # | 4 | # |
602 | 3 | # Author: Natalia Bidart <natalia.bidart@canonical.com> | 5 | # Author: Natalia Bidart <natalia.bidart@canonical.com> |
603 | @@ -63,6 +65,7 @@ | |||
604 | 63 | EMAIL_ALREADY_REGISTERED = 'a@example.com' | 65 | EMAIL_ALREADY_REGISTERED = 'a@example.com' |
605 | 64 | EMAIL_TOKEN = 'B2Pgtf' | 66 | EMAIL_TOKEN = 'B2Pgtf' |
606 | 65 | HELP = 'help text' | 67 | HELP = 'help text' |
607 | 68 | NAME = 'Juanito PĂ©rez' | ||
608 | 66 | PASSWORD = 'be4tiFul' | 69 | PASSWORD = 'be4tiFul' |
609 | 67 | RESET_PASSWORD_TOKEN = '8G5Wtq' | 70 | RESET_PASSWORD_TOKEN = '8G5Wtq' |
610 | 68 | TOKEN = {u'consumer_key': u'xQ7xDAz', | 71 | TOKEN = {u'consumer_key': u'xQ7xDAz', |
611 | @@ -107,7 +110,8 @@ | |||
612 | 107 | class FakedRegistrations(object): | 110 | class FakedRegistrations(object): |
613 | 108 | """Fake the registrations service.""" | 111 | """Fake the registrations service.""" |
614 | 109 | 112 | ||
616 | 110 | def register(self, email, password, captcha_id, captcha_solution): | 113 | def register(self, email, password, displayname, |
617 | 114 | captcha_id, captcha_solution): | ||
618 | 111 | """Fake registration. Return a fix result.""" | 115 | """Fake registration. Return a fix result.""" |
619 | 112 | if email == EMAIL_ALREADY_REGISTERED: | 116 | if email == EMAIL_ALREADY_REGISTERED: |
620 | 113 | return {'status': 'error', | 117 | return {'status': 'error', |
621 | @@ -399,6 +403,16 @@ | |||
622 | 399 | self.assertIn('Received invalid reply: %s' % STATUS_UNKNOWN, exc) | 403 | self.assertIn('Received invalid reply: %s' % STATUS_UNKNOWN, exc) |
623 | 400 | 404 | ||
624 | 401 | 405 | ||
625 | 406 | class SSORegistrationWithNameTestCase(SSOLoginProcessorTestCase): | ||
626 | 407 | """Test suite for the SSO login processor for register_with_name.""" | ||
627 | 408 | |||
628 | 409 | def setUp(self): | ||
629 | 410 | """Init.""" | ||
630 | 411 | super(SSORegistrationWithNameTestCase, self).setUp() | ||
631 | 412 | self.register_kwargs['displayname'] = NAME | ||
632 | 413 | self.processor.register_user = self.processor.register_with_name | ||
633 | 414 | |||
634 | 415 | |||
635 | 402 | class BlockingSampleException(Exception): | 416 | class BlockingSampleException(Exception): |
636 | 403 | """The exception that will be thrown by the fake blocking.""" | 417 | """The exception that will be thrown by the fake blocking.""" |
637 | 404 | 418 | ||
638 | @@ -510,8 +524,8 @@ | |||
639 | 510 | """Test that the register_user method works ok.""" | 524 | """Test that the register_user method works ok.""" |
640 | 511 | d = Deferred() | 525 | d = Deferred() |
641 | 512 | expected_result = "expected result" | 526 | expected_result = "expected result" |
644 | 513 | self.create_mock_processor().register_user(EMAIL, PASSWORD, CAPTCHA_ID, | 527 | self.create_mock_processor().register_user(EMAIL, PASSWORD, |
645 | 514 | CAPTCHA_SOLUTION) | 528 | CAPTCHA_ID, CAPTCHA_SOLUTION) |
646 | 515 | self.mocker.result(expected_result) | 529 | self.mocker.result(expected_result) |
647 | 516 | self.patch(ubuntu_sso.main, "blocking", self.fake_ok_blocking) | 530 | self.patch(ubuntu_sso.main, "blocking", self.fake_ok_blocking) |
648 | 517 | self.mocker.replay() | 531 | self.mocker.replay() |
649 | @@ -534,8 +548,8 @@ | |||
650 | 534 | """Test that the register_user method fails as expected.""" | 548 | """Test that the register_user method fails as expected.""" |
651 | 535 | d = Deferred() | 549 | d = Deferred() |
652 | 536 | expected_result = "expected result" | 550 | expected_result = "expected result" |
655 | 537 | self.create_mock_processor().register_user(EMAIL, PASSWORD, CAPTCHA_ID, | 551 | self.create_mock_processor().register_user(EMAIL, PASSWORD, |
656 | 538 | CAPTCHA_SOLUTION) | 552 | CAPTCHA_ID, CAPTCHA_SOLUTION) |
657 | 539 | self.mocker.result(expected_result) | 553 | self.mocker.result(expected_result) |
658 | 540 | self.patch(ubuntu_sso.main, "blocking", self.fake_err_blocking) | 554 | self.patch(ubuntu_sso.main, "blocking", self.fake_err_blocking) |
659 | 541 | self.mocker.replay() | 555 | self.mocker.replay() |
660 | @@ -554,6 +568,54 @@ | |||
661 | 554 | CAPTCHA_SOLUTION) | 568 | CAPTCHA_SOLUTION) |
662 | 555 | return d | 569 | return d |
663 | 556 | 570 | ||
664 | 571 | def test_register_with_name(self): | ||
665 | 572 | """Test that the register_with_name method works ok.""" | ||
666 | 573 | d = Deferred() | ||
667 | 574 | expected_result = "expected result" | ||
668 | 575 | self.create_mock_processor().register_with_name(EMAIL, PASSWORD, NAME, | ||
669 | 576 | CAPTCHA_ID, CAPTCHA_SOLUTION) | ||
670 | 577 | self.mocker.result(expected_result) | ||
671 | 578 | self.patch(ubuntu_sso.main, "blocking", self.fake_ok_blocking) | ||
672 | 579 | self.mocker.replay() | ||
673 | 580 | |||
674 | 581 | def verify(app_name, result): | ||
675 | 582 | """The actual test.""" | ||
676 | 583 | self.assertEqual(result, expected_result) | ||
677 | 584 | self.assertEqual(app_name, APP_NAME) | ||
678 | 585 | d.callback(result) | ||
679 | 586 | |||
680 | 587 | client = SSOLogin(self.mockbusname, | ||
681 | 588 | sso_login_processor_class=self.mockprocessorclass) | ||
682 | 589 | self.patch(client, "UserRegistered", verify) | ||
683 | 590 | self.patch(client, "UserRegistrationError", d.errback) | ||
684 | 591 | client.register_with_name(APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID, | ||
685 | 592 | CAPTCHA_SOLUTION) | ||
686 | 593 | return d | ||
687 | 594 | |||
688 | 595 | def test_register_with_name_error(self): | ||
689 | 596 | """Test that the register_with_name method fails as expected.""" | ||
690 | 597 | d = Deferred() | ||
691 | 598 | expected_result = "expected result" | ||
692 | 599 | self.create_mock_processor().register_with_name(EMAIL, PASSWORD, NAME, | ||
693 | 600 | CAPTCHA_ID, CAPTCHA_SOLUTION) | ||
694 | 601 | self.mocker.result(expected_result) | ||
695 | 602 | self.patch(ubuntu_sso.main, "blocking", self.fake_err_blocking) | ||
696 | 603 | self.mocker.replay() | ||
697 | 604 | |||
698 | 605 | def verify(app_name, errdict): | ||
699 | 606 | """The actual test.""" | ||
700 | 607 | self.assertEqual(errdict["errtype"], "BlockingSampleException") | ||
701 | 608 | self.assertEqual(app_name, APP_NAME) | ||
702 | 609 | d.callback("Ok") | ||
703 | 610 | |||
704 | 611 | client = SSOLogin(self.mockbusname, | ||
705 | 612 | sso_login_processor_class=self.mockprocessorclass) | ||
706 | 613 | self.patch(client, "UserRegistered", d.errback) | ||
707 | 614 | self.patch(client, "UserRegistrationError", verify) | ||
708 | 615 | client.register_with_name(APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID, | ||
709 | 616 | CAPTCHA_SOLUTION) | ||
710 | 617 | return d | ||
711 | 618 | |||
712 | 557 | def test_login(self): | 619 | def test_login(self): |
713 | 558 | """Test that the login method works ok.""" | 620 | """Test that the login method works ok.""" |
714 | 559 | d = Deferred() | 621 | d = Deferred() |