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
1=== modified file 'ubuntu_sso/gtk/gui.py'
2--- ubuntu_sso/gtk/gui.py 2012-04-09 17:38:24 +0000
3+++ ubuntu_sso/gtk/gui.py 2012-04-11 17:16:14 +0000
4@@ -539,11 +539,12 @@
5
6 msg = YES_TO_UPDATES % {'app_name': self.app_name}
7 self.yes_to_updates_checkbutton.set_label(msg)
8- if self.tc_url:
9- msg = YES_TO_TC % {'app_name': self.app_name}
10- self.yes_to_tc_checkbutton.set_label(msg)
11- self.tc_button.set_label(TC_BUTTON)
12- else:
13+
14+ msg = YES_TO_TC % {'app_name': self.app_name}
15+ self.yes_to_tc_checkbutton.set_label(msg)
16+ self.tc_button.set_label(TC_BUTTON)
17+
18+ if not self.tc_url:
19 self.tc_vbox.hide()
20 self.login_button.set_label(LOGIN_BUTTON_LABEL)
21
22@@ -741,6 +742,7 @@
23 name = self.name_entry.get_text()
24 if not name:
25 self.name_entry.set_warning(FIELD_REQUIRED)
26+ logger.warning('on_join_ok_button_clicked: name not set.')
27 error = True
28
29 # check email
30@@ -750,6 +752,7 @@
31 if msg is not None:
32 self.email1_entry.set_warning(msg)
33 self.email2_entry.set_warning(msg)
34+ logger.warning('on_join_ok_button_clicked: email is not valid.')
35 error = True
36
37 # check password
38@@ -759,22 +762,30 @@
39 if msg is not None:
40 self.password1_entry.set_warning(msg)
41 self.password2_entry.set_warning(msg)
42+ logger.warning('on_join_ok_button_clicked: password is not valid.')
43 error = True
44
45 # check T&C
46- if not self.yes_to_tc_checkbutton.get_active():
47+ if self.tc_url and not self.yes_to_tc_checkbutton.get_active():
48 self._set_warning_message(self.tc_warning_label,
49 TC_NOT_ACCEPTED % {'app_name': self.app_name})
50+ logger.warning('on_join_ok_button_clicked: terms and conditions '
51+ 'not accepted.')
52 error = True
53
54 captcha_solution = self.captcha_solution_entry.get_text()
55 if not captcha_solution:
56 self.captcha_solution_entry.set_warning(FIELD_REQUIRED)
57+ logger.warning('on_join_ok_button_clicked: captcha solution not '
58+ 'set.')
59 error = True
60
61 if error:
62+ logger.warning('on_join_ok_button_clicked: validation failed.')
63 return
64
65+ logger.info('on_join_ok_button_clicked: validation success!')
66+
67 self._set_current_page(self.processing_vbox)
68 self.user_email = email1
69 self.user_password = password1
70
71=== modified file 'ubuntu_sso/gtk/tests/test_gui.py'
72--- ubuntu_sso/gtk/tests/test_gui.py 2012-04-09 17:38:24 +0000
73+++ ubuntu_sso/gtk/tests/test_gui.py 2012-04-11 17:16:14 +0000
74@@ -473,8 +473,9 @@
75 # match passwords
76 self.ui.password1_entry.set_text(PASSWORD)
77 self.ui.password2_entry.set_text(PASSWORD)
78- # agree to TC
79- self.ui.yes_to_tc_checkbutton.set_active(True)
80+ if self.ui.tc_url:
81+ # agree to TC, only if the tc_url is defined, so we catch errors
82+ self.ui.yes_to_tc_checkbutton.set_active(True)
83 # resolve captcha properly
84 self.ui.captcha_solution_entry.set_text(CAPTCHA_SOLUTION)
85
86@@ -694,15 +695,15 @@
87 self.assertEqual(expected, actual,
88 msg % ('yes_to_tc_checkbutton', expected, actual))
89
90- def test_checkbutton_is_checked_at_startup(self):
91- """Checkbuttons are checked by default."""
92+ def test_updates_checkbutton_is_checked_at_startup(self):
93+ """The 'yes to updates' checkbutton is checked by default."""
94 msg = '%r is checked by default.'
95 name = 'yes_to_updates_checkbutton'
96 widget = getattr(self.ui, name)
97 self.assertTrue(widget.get_active(), msg % name)
98
99- def test_checkbutton_isnt_checked_at_startup(self):
100- """Checkbuttons are checked by default."""
101+ def test_tc_checkbutton_is_not_checked_at_startup(self):
102+ """The 'yes to T&C' checkbutton is not checked by default."""
103 msg = '%r is checked by default.'
104 name = 'yes_to_tc_checkbutton'
105 widget = getattr(self.ui, name)
106@@ -887,26 +888,22 @@
107 self.ui.on_captcha_generated(app_name=APP_NAME, captcha_id=CAPTCHA_ID)
108 self.assertEqual(self.ui.warning_label.get_text().decode('utf8'), '')
109
110-
111-class NoTermsAndConditionsTestCase(UbuntuSSOClientTestCase):
112+ def test_has_tc_link(self):
113+ """The T&C button and checkbox are shown if the link is provided"""
114+ self.assertEqual(self.ui.tc_button.get_visible(), True)
115+ self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
116+
117+
118+class NoTermsAndConditionsTestCase(EnterDetailsTestCase):
119 """Test suite for the user registration (with no t&c link)."""
120
121 kwargs = dict(app_name=APP_NAME, tc_url='', help_text=HELP_TEXT)
122
123- def test_no_tc_link(self):
124+ def test_has_tc_link(self):
125 """The T&C button and checkbox are not shown if no link is provided"""
126 self.assertEqual(self.ui.tc_vbox.get_visible(), False)
127
128
129-class TermsAndConditionsTestCase(UbuntuSSOClientTestCase):
130- """Test suite for the user registration (terms & conditions page)."""
131-
132- def test_has_tc_link(self):
133- """The T&C button and checkbox are shown if the link is provided"""
134- self.assertEqual(self.ui.tc_button.get_visible(), True)
135- self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
136-
137-
138 class TermsAndConditionsBrowserTestCase(UbuntuSSOClientTestCase):
139 """Test suite for the terms & conditions browser."""
140

Subscribers

People subscribed via source and target branches