Merge lp:~nataliabidart/ubuntu-sso-client/displayname-stable into lp:ubuntu-sso-client/stable-1-0

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 645
Merged at revision: 644
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/displayname-stable
Merge into: lp:ubuntu-sso-client/stable-1-0
Diff against target: 297 lines (+71/-62)
5 files modified
data/ui.glade (+40/-32)
ubuntu_sso/gui.py (+8/-10)
ubuntu_sso/main.py (+10/-7)
ubuntu_sso/tests/test_gui.py (+1/-6)
ubuntu_sso/tests/test_main.py (+12/-7)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/displayname-stable
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+54705@code.launchpad.net

Commit message

- Register now uses the 'displayname' field to pass it on to SSO as display name (LP: #709494).

Description of the change

To properly test please use the SRU instructions in the attached bug report. Thanks!

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Confirmed that I can't leave name blank, and the full name shows up in login.ubuntu.com, after using this branch to register from a maverick machine.

review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

Looks good, I launched the UI and everything worked as expected. Code looks good too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/ui.glade'
--- data/ui.glade 2010-08-27 20:13:59 +0000
+++ data/ui.glade 2011-03-24 14:16:06 +0000
@@ -264,36 +264,62 @@
264 </packing>264 </packing>
265 </child>265 </child>
266 <child>266 <child>
267 <object class="GtkHButtonBox" id="hbuttonbox1">267 <object class="GtkHBox" id="hbox2">
268 <property name="visible">True</property>268 <property name="visible">True</property>
269 <property name="spacing">5</property>
270 <property name="layout_style">end</property>
271 <child>269 <child>
272 <object class="GtkButton" id="join_cancel_button">270 <object class="GtkLinkButton" id="login_button">
273 <property name="label">gtk-cancel</property>271 <property name="label">login button</property>
274 <property name="visible">True</property>272 <property name="visible">True</property>
275 <property name="can_focus">True</property>273 <property name="can_focus">True</property>
276 <property name="receives_default">True</property>274 <property name="receives_default">True</property>
277 <property name="use_stock">True</property>275 <property name="relief">none</property>
276 <signal name="clicked" handler="on_sign_in_button_clicked" swapped="no"/>
278 </object>277 </object>
279 <packing>278 <packing>
280 <property name="expand">False</property>279 <property name="expand">False</property>
281 <property name="fill">False</property>280 <property name="fill">True</property>
282 <property name="position">0</property>281 <property name="position">0</property>
283 </packing>282 </packing>
284 </child>283 </child>
285 <child>284 <child>
286 <object class="GtkButton" id="join_ok_button">285 <object class="GtkHButtonBox" id="hbuttonbox1">
287 <property name="label">gtk-go-forward</property>
288 <property name="visible">True</property>286 <property name="visible">True</property>
289 <property name="can_focus">True</property>287 <property name="can_focus">False</property>
290 <property name="receives_default">True</property>288 <property name="spacing">5</property>
291 <property name="use_stock">True</property>289 <property name="layout_style">end</property>
292 <signal name="clicked" handler="on_join_ok_button_clicked"/>290 <child>
291 <object class="GtkButton" id="join_cancel_button">
292 <property name="label">gtk-cancel</property>
293 <property name="visible">True</property>
294 <property name="can_focus">True</property>
295 <property name="receives_default">True</property>
296 <property name="use_stock">True</property>
297 </object>
298 <packing>
299 <property name="expand">False</property>
300 <property name="fill">False</property>
301 <property name="position">0</property>
302 </packing>
303 </child>
304 <child>
305 <object class="GtkButton" id="join_ok_button">
306 <property name="label">gtk-go-forward</property>
307 <property name="visible">True</property>
308 <property name="can_focus">True</property>
309 <property name="receives_default">True</property>
310 <property name="use_stock">True</property>
311 <signal name="clicked" handler="on_join_ok_button_clicked" swapped="no"/>
312 </object>
313 <packing>
314 <property name="expand">False</property>
315 <property name="fill">False</property>
316 <property name="position">1</property>
317 </packing>
318 </child>
293 </object>319 </object>
294 <packing>320 <packing>
295 <property name="expand">False</property>321 <property name="expand">False</property>
296 <property name="fill">False</property>322 <property name="pack_type">end</property>
297 <property name="position">1</property>323 <property name="position">1</property>
298 </packing>324 </packing>
299 </child>325 </child>
@@ -303,24 +329,6 @@
303 <property name="position">12</property>329 <property name="position">12</property>
304 </packing>330 </packing>
305 </child>331 </child>
306 <child>
307 <object class="GtkLinkButton" id="login_button">
308 <property name="label" translatable="yes">login button</property>
309 <property name="visible">True</property>
310 <property name="can_focus">True</property>
311 <property name="receives_default">True</property>
312 <property name="has_tooltip">True</property>
313 <property name="relief">none</property>
314 <signal name="clicked" handler="on_sign_in_button_clicked"/>
315 </object>
316 <packing>
317 <property name="expand">False</property>
318 <property name="position">13</property>
319 </packing>
320 </child>
321 <child>
322 <placeholder/>
323 </child>
324 </object>332 </object>
325 <object class="GtkVBox" id="processing_vbox">333 <object class="GtkVBox" id="processing_vbox">
326 <property name="visible">True</property>334 <property name="visible">True</property>
327335
=== modified file 'ubuntu_sso/gui.py'
--- ubuntu_sso/gui.py 2010-12-15 21:39:30 +0000
+++ ubuntu_sso/gui.py 2011-03-24 14:16:06 +0000
@@ -387,8 +387,6 @@
387 msg = 'UbuntuSSOClientGUI: failed set_transient_for win id %r'387 msg = 'UbuntuSSOClientGUI: failed set_transient_for win id %r'
388 logger.exception(msg, window_id)388 logger.exception(msg, window_id)
389389
390 # Hidding unused widgets to save some space (LP #627440).
391 self.name_entry.hide()
392 self.yes_to_updates_checkbutton.hide()390 self.yes_to_updates_checkbutton.hide()
393391
394 self.window.show()392 self.window.show()
@@ -769,11 +767,10 @@
769767
770 error = False768 error = False
771769
772 # Hidding unused widgets to save some space (LP #627440).770 name = self.name_entry.get_text()
773 #name = self.name_entry.get_text()771 if not name:
774 #if not name:772 self.name_entry.set_warning(self.FIELD_REQUIRED)
775 # self.name_entry.set_warning(self.FIELD_REQUIRED)773 error = True
776 # error = True
777774
778 # check email775 # check email
779 email1 = self.email1_entry.get_text()776 email1 = self.email1_entry.get_text()
@@ -812,10 +809,11 @@
812 self.user_password = password1809 self.user_password = password1
813810
814 logger.info('Calling register_user with email %r, password <hidden>,' \811 logger.info('Calling register_user with email %r, password <hidden>,' \
815 ' captcha_id %r and captcha_solution %r.', email1,812 ' name %r, captcha_id %r and captcha_solution %r.', email1,
816 self._captcha_id, captcha_solution)813 name, self._captcha_id, captcha_solution)
817 f = self.backend.register_user814 f = self.backend.register_user
818 f(self.app_name, email1, password1, self._captcha_id, captcha_solution,815 f(self.app_name, email1, password1, name,
816 self._captcha_id, captcha_solution,
819 reply_handler=NO_OP, error_handler=NO_OP)817 reply_handler=NO_OP, error_handler=NO_OP)
820818
821 def on_tc_button_clicked(self, *args, **kwargs):819 def on_tc_button_clicked(self, *args, **kwargs):
822820
=== modified file 'ubuntu_sso/main.py'
--- ubuntu_sso/main.py 2010-12-15 21:39:30 +0000
+++ ubuntu_sso/main.py 2011-03-24 14:16:06 +0000
@@ -171,11 +171,12 @@
171171
172 return captcha['captcha_id']172 return captcha['captcha_id']
173173
174 def register_user(self, email, password, captcha_id, captcha_solution):174 def register_user(self, email, password, displayname,
175 captcha_id, captcha_solution):
175 """Register a new user with 'email' and 'password'."""176 """Register a new user with 'email' and 'password'."""
176 logger.debug('register_user: email: %r password: <hidden>, '177 logger.debug('register_user: email: %r password: <hidden>, '
177 'captcha_id: %r, captcha_solution: %r',178 'displayname: %r, captcha_id: %r, captcha_solution: %r',
178 email, captcha_id, captcha_solution)179 email, displayname, captcha_id, captcha_solution)
179 sso_service = self.sso_service_class(None, self.service_url)180 sso_service = self.sso_service_class(None, self.service_url)
180 if not self._valid_email(email):181 if not self._valid_email(email):
181 logger.error('register_user: InvalidEmailError for email: %r',182 logger.error('register_user: InvalidEmailError for email: %r',
@@ -186,7 +187,9 @@
186 raise InvalidPasswordError()187 raise InvalidPasswordError()
187188
188 result = sso_service.registrations.register(189 result = sso_service.registrations.register(
189 email=email, password=password, captcha_id=captcha_id,190 email=email, password=password,
191 displayname=displayname,
192 captcha_id=captcha_id,
190 captcha_solution=captcha_solution)193 captcha_solution=captcha_solution)
191 logger.info('register_user: email: %r result: %r', email, result)194 logger.info('register_user: email: %r result: %r', email, result)
192195
@@ -377,13 +380,13 @@
377 'app_name "%s" and error %r', app_name, error)380 'app_name "%s" and error %r', app_name, error)
378381
379 @dbus.service.method(dbus_interface=DBUS_IFACE_USER_NAME,382 @dbus.service.method(dbus_interface=DBUS_IFACE_USER_NAME,
380 in_signature='sssss')383 in_signature='ssssss')
381 def register_user(self, app_name, email, password,384 def register_user(self, app_name, email, password, name,
382 captcha_id, captcha_solution):385 captcha_id, captcha_solution):
383 """Call the matching method in the processor."""386 """Call the matching method in the processor."""
384 def f():387 def f():
385 """Inner function that will be run in a thread."""388 """Inner function that will be run in a thread."""
386 return self.processor.register_user(email, password,389 return self.processor.register_user(email, password, name,
387 captcha_id, captcha_solution)390 captcha_id, captcha_solution)
388 blocking(f, app_name, self.UserRegistered, self.UserRegistrationError)391 blocking(f, app_name, self.UserRegistered, self.UserRegistrationError)
389392
390393
=== modified file 'ubuntu_sso/tests/test_gui.py'
--- ubuntu_sso/tests/test_gui.py 2010-11-03 17:43:17 +0000
+++ ubuntu_sso/tests/test_gui.py 2011-03-24 14:16:06 +0000
@@ -678,7 +678,7 @@
678 expected = 'register_user'678 expected = 'register_user'
679 self.assertIn(expected, self.ui.backend._called)679 self.assertIn(expected, self.ui.backend._called)
680 self.assertEqual(self.ui.backend._called[expected],680 self.assertEqual(self.ui.backend._called[expected],
681 ((APP_NAME, EMAIL, PASSWORD, CAPTCHA_ID,681 ((APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID,
682 CAPTCHA_SOLUTION),682 CAPTCHA_SOLUTION),
683 dict(reply_handler=gui.NO_OP,683 dict(reply_handler=gui.NO_OP,
684 error_handler=gui.NO_OP)))684 error_handler=gui.NO_OP)))
@@ -1163,11 +1163,6 @@
1163 self.ui.FIELD_REQUIRED)1163 self.ui.FIELD_REQUIRED)
1164 self.assertNotIn('register_user', self.ui.backend._called)1164 self.assertNotIn('register_user', self.ui.backend._called)
11651165
1166 # Unused variable 'skip'
1167 # pylint: disable=W0612
1168 test_warning_is_shown_if_name_empty.skip = \
1169 'Unused for now, will be hidden to save space (LP: #627440).'
1170
1171 def test_warning_is_shown_if_empty_email(self):1166 def test_warning_is_shown_if_empty_email(self):
1172 """A warning message is shown if emails are empty."""1167 """A warning message is shown if emails are empty."""
1173 self.ui.email1_entry.set_text('')1168 self.ui.email1_entry.set_text('')
11741169
=== modified file 'ubuntu_sso/tests/test_main.py'
--- ubuntu_sso/tests/test_main.py 2010-12-15 21:39:30 +0000
+++ ubuntu_sso/tests/test_main.py 2011-03-24 14:16:06 +0000
@@ -1,3 +1,5 @@
1# -*- coding: utf-8 -*-
2#
1# test_main - tests for ubuntu_sso.main3# test_main - tests for ubuntu_sso.main
2#4#
3# Author: Natalia Bidart <natalia.bidart@canonical.com>5# Author: Natalia Bidart <natalia.bidart@canonical.com>
@@ -63,6 +65,7 @@
63EMAIL_ALREADY_REGISTERED = 'a@example.com'65EMAIL_ALREADY_REGISTERED = 'a@example.com'
64EMAIL_TOKEN = 'B2Pgtf'66EMAIL_TOKEN = 'B2Pgtf'
65HELP = 'help text'67HELP = 'help text'
68NAME = 'Juanito Pérez'
66PASSWORD = 'be4tiFul'69PASSWORD = 'be4tiFul'
67RESET_PASSWORD_TOKEN = '8G5Wtq'70RESET_PASSWORD_TOKEN = '8G5Wtq'
68TOKEN = {u'consumer_key': u'xQ7xDAz',71TOKEN = {u'consumer_key': u'xQ7xDAz',
@@ -107,7 +110,8 @@
107class FakedRegistrations(object):110class FakedRegistrations(object):
108 """Fake the registrations service."""111 """Fake the registrations service."""
109112
110 def register(self, email, password, captcha_id, captcha_solution):113 def register(self, email, password, displayname,
114 captcha_id, captcha_solution):
111 """Fake registration. Return a fix result."""115 """Fake registration. Return a fix result."""
112 if email == EMAIL_ALREADY_REGISTERED:116 if email == EMAIL_ALREADY_REGISTERED:
113 return {'status': 'error',117 return {'status': 'error',
@@ -196,6 +200,7 @@
196 """Init."""200 """Init."""
197 self.processor = SSOLoginProcessor(sso_service_class=FakedSSOServer)201 self.processor = SSOLoginProcessor(sso_service_class=FakedSSOServer)
198 self.register_kwargs = dict(email=EMAIL, password=PASSWORD,202 self.register_kwargs = dict(email=EMAIL, password=PASSWORD,
203 displayname=NAME,
199 captcha_id=CAPTCHA_ID,204 captcha_id=CAPTCHA_ID,
200 captcha_solution=CAPTCHA_SOLUTION)205 captcha_solution=CAPTCHA_SOLUTION)
201 self.login_kwargs = dict(email=EMAIL, password=PASSWORD,206 self.login_kwargs = dict(email=EMAIL, password=PASSWORD,
@@ -510,8 +515,8 @@
510 """Test that the register_user method works ok."""515 """Test that the register_user method works ok."""
511 d = Deferred()516 d = Deferred()
512 expected_result = "expected result"517 expected_result = "expected result"
513 self.create_mock_processor().register_user(EMAIL, PASSWORD, CAPTCHA_ID,518 self.create_mock_processor().register_user(EMAIL, PASSWORD, NAME,
514 CAPTCHA_SOLUTION)519 CAPTCHA_ID, CAPTCHA_SOLUTION)
515 self.mocker.result(expected_result)520 self.mocker.result(expected_result)
516 self.patch(ubuntu_sso.main, "blocking", self.fake_ok_blocking)521 self.patch(ubuntu_sso.main, "blocking", self.fake_ok_blocking)
517 self.mocker.replay()522 self.mocker.replay()
@@ -526,7 +531,7 @@
526 sso_login_processor_class=self.mockprocessorclass)531 sso_login_processor_class=self.mockprocessorclass)
527 self.patch(client, "UserRegistered", verify)532 self.patch(client, "UserRegistered", verify)
528 self.patch(client, "UserRegistrationError", d.errback)533 self.patch(client, "UserRegistrationError", d.errback)
529 client.register_user(APP_NAME, EMAIL, PASSWORD, CAPTCHA_ID,534 client.register_user(APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID,
530 CAPTCHA_SOLUTION)535 CAPTCHA_SOLUTION)
531 return d536 return d
532537
@@ -534,8 +539,8 @@
534 """Test that the register_user method fails as expected."""539 """Test that the register_user method fails as expected."""
535 d = Deferred()540 d = Deferred()
536 expected_result = "expected result"541 expected_result = "expected result"
537 self.create_mock_processor().register_user(EMAIL, PASSWORD, CAPTCHA_ID,542 self.create_mock_processor().register_user(EMAIL, PASSWORD, NAME,
538 CAPTCHA_SOLUTION)543 CAPTCHA_ID, CAPTCHA_SOLUTION)
539 self.mocker.result(expected_result)544 self.mocker.result(expected_result)
540 self.patch(ubuntu_sso.main, "blocking", self.fake_err_blocking)545 self.patch(ubuntu_sso.main, "blocking", self.fake_err_blocking)
541 self.mocker.replay()546 self.mocker.replay()
@@ -550,7 +555,7 @@
550 sso_login_processor_class=self.mockprocessorclass)555 sso_login_processor_class=self.mockprocessorclass)
551 self.patch(client, "UserRegistered", d.errback)556 self.patch(client, "UserRegistered", d.errback)
552 self.patch(client, "UserRegistrationError", verify)557 self.patch(client, "UserRegistrationError", verify)
553 client.register_user(APP_NAME, EMAIL, PASSWORD, CAPTCHA_ID,558 client.register_user(APP_NAME, EMAIL, PASSWORD, NAME, CAPTCHA_ID,
554 CAPTCHA_SOLUTION)559 CAPTCHA_SOLUTION)
555 return d560 return d
556561

Subscribers

People subscribed via source and target branches