Merge lp:~nataliabidart/ubuntu-sso-client/fix-960657-stable-3-0 into lp:ubuntu-sso-client/stable-3-0

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 837
Merged at revision: 837
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/fix-960657-stable-3-0
Merge into: lp:ubuntu-sso-client/stable-3-0
Diff against target: 139 lines (+32/-24)
2 files modified
ubuntu_sso/gtk/gui.py (+17/-6)
ubuntu_sso/gtk/tests/test_gui.py (+15/-18)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/fix-960657-stable-3-0
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+101611@code.launchpad.net

Commit message

- When validating the registration screen (in the GTK+ UI), do not force
  accepting the T&C if the tc_url is not defined (LP: #960657).
- Added more logging entries to the registration screen (GTK+ UI) validation
  process.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_sso/gtk/gui.py'
--- ubuntu_sso/gtk/gui.py 2012-04-09 17:38:24 +0000
+++ ubuntu_sso/gtk/gui.py 2012-04-11 17:16:14 +0000
@@ -539,11 +539,12 @@
539539
540 msg = YES_TO_UPDATES % {'app_name': self.app_name}540 msg = YES_TO_UPDATES % {'app_name': self.app_name}
541 self.yes_to_updates_checkbutton.set_label(msg)541 self.yes_to_updates_checkbutton.set_label(msg)
542 if self.tc_url:542
543 msg = YES_TO_TC % {'app_name': self.app_name}543 msg = YES_TO_TC % {'app_name': self.app_name}
544 self.yes_to_tc_checkbutton.set_label(msg)544 self.yes_to_tc_checkbutton.set_label(msg)
545 self.tc_button.set_label(TC_BUTTON)545 self.tc_button.set_label(TC_BUTTON)
546 else:546
547 if not self.tc_url:
547 self.tc_vbox.hide()548 self.tc_vbox.hide()
548 self.login_button.set_label(LOGIN_BUTTON_LABEL)549 self.login_button.set_label(LOGIN_BUTTON_LABEL)
549550
@@ -741,6 +742,7 @@
741 name = self.name_entry.get_text()742 name = self.name_entry.get_text()
742 if not name:743 if not name:
743 self.name_entry.set_warning(FIELD_REQUIRED)744 self.name_entry.set_warning(FIELD_REQUIRED)
745 logger.warning('on_join_ok_button_clicked: name not set.')
744 error = True746 error = True
745747
746 # check email748 # check email
@@ -750,6 +752,7 @@
750 if msg is not None:752 if msg is not None:
751 self.email1_entry.set_warning(msg)753 self.email1_entry.set_warning(msg)
752 self.email2_entry.set_warning(msg)754 self.email2_entry.set_warning(msg)
755 logger.warning('on_join_ok_button_clicked: email is not valid.')
753 error = True756 error = True
754757
755 # check password758 # check password
@@ -759,22 +762,30 @@
759 if msg is not None:762 if msg is not None:
760 self.password1_entry.set_warning(msg)763 self.password1_entry.set_warning(msg)
761 self.password2_entry.set_warning(msg)764 self.password2_entry.set_warning(msg)
765 logger.warning('on_join_ok_button_clicked: password is not valid.')
762 error = True766 error = True
763767
764 # check T&C768 # check T&C
765 if not self.yes_to_tc_checkbutton.get_active():769 if self.tc_url and not self.yes_to_tc_checkbutton.get_active():
766 self._set_warning_message(self.tc_warning_label,770 self._set_warning_message(self.tc_warning_label,
767 TC_NOT_ACCEPTED % {'app_name': self.app_name})771 TC_NOT_ACCEPTED % {'app_name': self.app_name})
772 logger.warning('on_join_ok_button_clicked: terms and conditions '
773 'not accepted.')
768 error = True774 error = True
769775
770 captcha_solution = self.captcha_solution_entry.get_text()776 captcha_solution = self.captcha_solution_entry.get_text()
771 if not captcha_solution:777 if not captcha_solution:
772 self.captcha_solution_entry.set_warning(FIELD_REQUIRED)778 self.captcha_solution_entry.set_warning(FIELD_REQUIRED)
779 logger.warning('on_join_ok_button_clicked: captcha solution not '
780 'set.')
773 error = True781 error = True
774782
775 if error:783 if error:
784 logger.warning('on_join_ok_button_clicked: validation failed.')
776 return785 return
777786
787 logger.info('on_join_ok_button_clicked: validation success!')
788
778 self._set_current_page(self.processing_vbox)789 self._set_current_page(self.processing_vbox)
779 self.user_email = email1790 self.user_email = email1
780 self.user_password = password1791 self.user_password = password1
781792
=== modified file 'ubuntu_sso/gtk/tests/test_gui.py'
--- ubuntu_sso/gtk/tests/test_gui.py 2012-04-09 17:38:24 +0000
+++ ubuntu_sso/gtk/tests/test_gui.py 2012-04-11 17:16:14 +0000
@@ -473,8 +473,9 @@
473 # match passwords473 # match passwords
474 self.ui.password1_entry.set_text(PASSWORD)474 self.ui.password1_entry.set_text(PASSWORD)
475 self.ui.password2_entry.set_text(PASSWORD)475 self.ui.password2_entry.set_text(PASSWORD)
476 # agree to TC476 if self.ui.tc_url:
477 self.ui.yes_to_tc_checkbutton.set_active(True)477 # agree to TC, only if the tc_url is defined, so we catch errors
478 self.ui.yes_to_tc_checkbutton.set_active(True)
478 # resolve captcha properly479 # resolve captcha properly
479 self.ui.captcha_solution_entry.set_text(CAPTCHA_SOLUTION)480 self.ui.captcha_solution_entry.set_text(CAPTCHA_SOLUTION)
480481
@@ -694,15 +695,15 @@
694 self.assertEqual(expected, actual,695 self.assertEqual(expected, actual,
695 msg % ('yes_to_tc_checkbutton', expected, actual))696 msg % ('yes_to_tc_checkbutton', expected, actual))
696697
697 def test_checkbutton_is_checked_at_startup(self):698 def test_updates_checkbutton_is_checked_at_startup(self):
698 """Checkbuttons are checked by default."""699 """The 'yes to updates' checkbutton is checked by default."""
699 msg = '%r is checked by default.'700 msg = '%r is checked by default.'
700 name = 'yes_to_updates_checkbutton'701 name = 'yes_to_updates_checkbutton'
701 widget = getattr(self.ui, name)702 widget = getattr(self.ui, name)
702 self.assertTrue(widget.get_active(), msg % name)703 self.assertTrue(widget.get_active(), msg % name)
703704
704 def test_checkbutton_isnt_checked_at_startup(self):705 def test_tc_checkbutton_is_not_checked_at_startup(self):
705 """Checkbuttons are checked by default."""706 """The 'yes to T&C' checkbutton is not checked by default."""
706 msg = '%r is checked by default.'707 msg = '%r is checked by default.'
707 name = 'yes_to_tc_checkbutton'708 name = 'yes_to_tc_checkbutton'
708 widget = getattr(self.ui, name)709 widget = getattr(self.ui, name)
@@ -887,26 +888,22 @@
887 self.ui.on_captcha_generated(app_name=APP_NAME, captcha_id=CAPTCHA_ID)888 self.ui.on_captcha_generated(app_name=APP_NAME, captcha_id=CAPTCHA_ID)
888 self.assertEqual(self.ui.warning_label.get_text().decode('utf8'), '')889 self.assertEqual(self.ui.warning_label.get_text().decode('utf8'), '')
889890
890891 def test_has_tc_link(self):
891class NoTermsAndConditionsTestCase(UbuntuSSOClientTestCase):892 """The T&C button and checkbox are shown if the link is provided"""
893 self.assertEqual(self.ui.tc_button.get_visible(), True)
894 self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
895
896
897class NoTermsAndConditionsTestCase(EnterDetailsTestCase):
892 """Test suite for the user registration (with no t&c link)."""898 """Test suite for the user registration (with no t&c link)."""
893899
894 kwargs = dict(app_name=APP_NAME, tc_url='', help_text=HELP_TEXT)900 kwargs = dict(app_name=APP_NAME, tc_url='', help_text=HELP_TEXT)
895901
896 def test_no_tc_link(self):902 def test_has_tc_link(self):
897 """The T&C button and checkbox are not shown if no link is provided"""903 """The T&C button and checkbox are not shown if no link is provided"""
898 self.assertEqual(self.ui.tc_vbox.get_visible(), False)904 self.assertEqual(self.ui.tc_vbox.get_visible(), False)
899905
900906
901class TermsAndConditionsTestCase(UbuntuSSOClientTestCase):
902 """Test suite for the user registration (terms & conditions page)."""
903
904 def test_has_tc_link(self):
905 """The T&C button and checkbox are shown if the link is provided"""
906 self.assertEqual(self.ui.tc_button.get_visible(), True)
907 self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
908
909
910class TermsAndConditionsBrowserTestCase(UbuntuSSOClientTestCase):907class TermsAndConditionsBrowserTestCase(UbuntuSSOClientTestCase):
911 """Test suite for the terms & conditions browser."""908 """Test suite for the terms & conditions browser."""
912909

Subscribers

People subscribed via source and target branches