Merge lp:~diegosarmentero/ubuntuone-windows-installer/reset-password-page into lp:ubuntuone-windows-installer
- reset-password-page
- Merge into trunk
Proposed by
Diego Sarmentero
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Roberto Alsina | ||||
Approved revision: | 47 | ||||
Merged at revision: | 50 | ||||
Proposed branch: | lp:~diegosarmentero/ubuntuone-windows-installer/reset-password-page | ||||
Merge into: | lp:ubuntuone-windows-installer | ||||
Diff against target: |
402 lines (+29/-266) 2 files modified
ubuntuone_installer/gui/qt/setup_account.py (+18/-74) ubuntuone_installer/gui/qt/tests/test_setup_account.py (+11/-192) |
||||
To merge this branch: | bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/reset-password-page | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Natalia Bidart (community) | Approve | ||
Review via email:
|
Commit message
Reset Password Page Complete.
Description of the change
Reset Password Page Complete.
To post a comment you must log in.
- 46. By Diego Sarmentero
-
Changed utils.ui to common in setup_account and test_setup_account.
Merge.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Diego Sarmentero (diegosarmentero) wrote : | # |
- 47. By Diego Sarmentero
-
Assigning bug.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Natalia Bidart (nataliabidart) wrote : | # |
Looks good!
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ubuntuone_installer/gui/qt/setup_account.py' | |||
2 | --- ubuntuone_installer/gui/qt/setup_account.py 2011-08-31 16:23:45 +0000 | |||
3 | +++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-06 15:25:05 +0000 | |||
4 | @@ -23,6 +23,7 @@ | |||
5 | 23 | 23 | ||
6 | 24 | from PyQt4 import QtGui, QtCore | 24 | from PyQt4 import QtGui, QtCore |
7 | 25 | 25 | ||
8 | 26 | from ubuntu_sso.qt import common | ||
9 | 26 | from ubuntu_sso.qt import gui as sso_gui | 27 | from ubuntu_sso.qt import gui as sso_gui |
10 | 27 | 28 | ||
11 | 28 | from ubuntuone_installer.gui.qt import enhanced_check_box | 29 | from ubuntuone_installer.gui.qt import enhanced_check_box |
12 | @@ -30,10 +31,7 @@ | |||
13 | 30 | _ = gettext.gettext | 31 | _ = gettext.gettext |
14 | 31 | 32 | ||
15 | 32 | # pylint: disable=C0103 | 33 | # pylint: disable=C0103 |
16 | 33 | BAD = u'<img src=":/password_hint_warning.png" /><font> %s </font>' | ||
17 | 34 | ERROR = u'<font color="#df2d1f"><b> %s </b></font>' | 34 | ERROR = u'<font color="#df2d1f"><b> %s </b></font>' |
18 | 35 | GOOD = u'<img src=":/password_hint_ok.png" /><font> %s </font>' | ||
19 | 36 | NORMAL = u'<font> %s </font>' | ||
20 | 37 | TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>" | 35 | TITLE_STYLE = "<span style=\"font-size:24px\">%s</span>" |
21 | 38 | 36 | ||
22 | 39 | EMAIL = _("Email") | 37 | EMAIL = _("Email") |
23 | @@ -42,11 +40,6 @@ | |||
24 | 42 | EMAIL_MATCH = _("The email addresses do not match") | 40 | EMAIL_MATCH = _("The email addresses do not match") |
25 | 43 | NAME = _("Name") | 41 | NAME = _("Name") |
26 | 44 | PASSWORD = _("Create a password") | 42 | PASSWORD = _("Create a password") |
27 | 45 | PASSWORD_LENGTH = _("At least 8 characters") | ||
28 | 46 | PASSWORD_DIGIT = _("At least one number") | ||
29 | 47 | PASSWORD_UPPER = _("At least one uppercase letter") | ||
30 | 48 | PASSWORD_MATCH = _("Passwords don't match") | ||
31 | 49 | PASSWORD_MUST_CONTAIN = _("Your password must contain") | ||
32 | 50 | RETYPE_EMAIL = _("Retype email") | 43 | RETYPE_EMAIL = _("Retype email") |
33 | 51 | RETYPE_PASSWORD = _("Retype password") | 44 | RETYPE_PASSWORD = _("Retype password") |
34 | 52 | SUBTITLE = _("You only need to set up your account " | 45 | SUBTITLE = _("You only need to set up your account " |
35 | @@ -67,7 +60,9 @@ | |||
36 | 67 | def __init__(self, *args, **kwargs): | 60 | def __init__(self, *args, **kwargs): |
37 | 68 | super(SetupAccountPage, self).__init__(*args, **kwargs) | 61 | super(SetupAccountPage, self).__init__(*args, **kwargs) |
38 | 69 | self.ui.password_edit.textEdited.connect( | 62 | self.ui.password_edit.textEdited.connect( |
40 | 70 | lambda: self.password_assistance(NORMAL)) | 63 | lambda: common.password_assistance(self.ui.password_edit, |
41 | 64 | self.ui.password_assistance, | ||
42 | 65 | common.NORMAL)) | ||
43 | 71 | terms = TERMS.format(terms_and_conditions=TERMS_LINK, | 66 | terms = TERMS.format(terms_and_conditions=TERMS_LINK, |
44 | 72 | privacy_policy=PRIVACY_POLICY_LINK) | 67 | privacy_policy=PRIVACY_POLICY_LINK) |
45 | 73 | self.terms_checkbox = enhanced_check_box.EnhancedCheckBox(terms) | 68 | self.terms_checkbox = enhanced_check_box.EnhancedCheckBox(terms) |
46 | @@ -78,9 +73,15 @@ | |||
47 | 78 | self.name_assistance, | 73 | self.name_assistance, |
48 | 79 | self.email_assistance, | 74 | self.email_assistance, |
49 | 80 | self.confirm_email_assistance, | 75 | self.confirm_email_assistance, |
51 | 81 | self.password_check_match] | 76 | self.password_check_match_wrapper] |
52 | 82 | self.set_up_button = None | 77 | self.set_up_button = None |
53 | 83 | 78 | ||
54 | 79 | def password_check_match_wrapper(self): | ||
55 | 80 | """Wrapper between validation_functions calls and utils function.""" | ||
56 | 81 | common.password_check_match(self.ui.password_edit, | ||
57 | 82 | self.ui.confirm_password_edit, | ||
58 | 83 | self.ui.password_assistance) | ||
59 | 84 | |||
60 | 84 | # Invalid name "initializePage" | 85 | # Invalid name "initializePage" |
61 | 85 | # pylint: disable=C0103 | 86 | # pylint: disable=C0103 |
62 | 86 | 87 | ||
63 | @@ -114,7 +115,7 @@ | |||
64 | 114 | QtGui.QWizard.Stretch, | 115 | QtGui.QWizard.Stretch, |
65 | 115 | QtGui.QWizard.CustomButton3]) | 116 | QtGui.QWizard.CustomButton3]) |
66 | 116 | 117 | ||
68 | 117 | self.password_default_assistance() | 118 | common.password_default_assistance(self.ui.password_assistance) |
69 | 118 | # Hide assistance labels by default | 119 | # Hide assistance labels by default |
70 | 119 | self.ui.name_assistance.setVisible(False) | 120 | self.ui.name_assistance.setVisible(False) |
71 | 120 | self.ui.email_assistance.setVisible(False) | 121 | self.ui.email_assistance.setVisible(False) |
72 | @@ -145,10 +146,10 @@ | |||
73 | 145 | if not text.strip(): | 146 | if not text.strip(): |
74 | 146 | self.ui.name_assistance.setVisible(True) | 147 | self.ui.name_assistance.setVisible(True) |
75 | 147 | self.ui.name_assistance.setText(ERROR % EMPTY_NAME) | 148 | self.ui.name_assistance.setText(ERROR % EMPTY_NAME) |
77 | 148 | self.check_as_invalid(self.ui.name_edit) | 149 | common.check_as_invalid(self.ui.name_edit) |
78 | 149 | else: | 150 | else: |
79 | 150 | self.ui.name_assistance.setVisible(False) | 151 | self.ui.name_assistance.setVisible(False) |
81 | 151 | self.check_as_valid(self.ui.name_edit) | 152 | common.check_as_valid(self.ui.name_edit) |
82 | 152 | 153 | ||
83 | 153 | def email_assistance(self): | 154 | def email_assistance(self): |
84 | 154 | """Show help for the email field.""" | 155 | """Show help for the email field.""" |
85 | @@ -156,10 +157,10 @@ | |||
86 | 156 | if not is_correct_email(text): | 157 | if not is_correct_email(text): |
87 | 157 | self.ui.email_assistance.setText(ERROR % INVALID_EMAIL) | 158 | self.ui.email_assistance.setText(ERROR % INVALID_EMAIL) |
88 | 158 | self.ui.email_assistance.setVisible(True) | 159 | self.ui.email_assistance.setVisible(True) |
90 | 159 | self.check_as_invalid(self.ui.email_edit) | 160 | common.check_as_invalid(self.ui.email_edit) |
91 | 160 | else: | 161 | else: |
92 | 161 | self.ui.email_assistance.setVisible(False) | 162 | self.ui.email_assistance.setVisible(False) |
94 | 162 | self.check_as_valid(self.ui.email_edit) | 163 | common.check_as_valid(self.ui.email_edit) |
95 | 163 | 164 | ||
96 | 164 | def confirm_email_assistance(self): | 165 | def confirm_email_assistance(self): |
97 | 165 | """Show help for the confirm email field.""" | 166 | """Show help for the confirm email field.""" |
98 | @@ -168,67 +169,10 @@ | |||
99 | 168 | if text1 != text2: | 169 | if text1 != text2: |
100 | 169 | self.ui.confirm_email_assistance.setText(ERROR % EMAIL_MATCH) | 170 | self.ui.confirm_email_assistance.setText(ERROR % EMAIL_MATCH) |
101 | 170 | self.ui.confirm_email_assistance.setVisible(True) | 171 | self.ui.confirm_email_assistance.setVisible(True) |
103 | 171 | self.check_as_invalid(self.ui.confirm_email_edit) | 172 | common.check_as_invalid(self.ui.confirm_email_edit) |
104 | 172 | else: | 173 | else: |
105 | 173 | self.ui.confirm_email_assistance.setVisible(False) | 174 | self.ui.confirm_email_assistance.setVisible(False) |
164 | 174 | self.check_as_valid(self.ui.confirm_email_edit) | 175 | common.check_as_valid(self.ui.confirm_email_edit) |
107 | 175 | |||
108 | 176 | def password_assistance(self, icon_type=BAD): | ||
109 | 177 | """Show help for the password field.""" | ||
110 | 178 | text1 = unicode(self.ui.password_edit.text()) | ||
111 | 179 | label_text = ["<b>%s</b>" % PASSWORD_MUST_CONTAIN, ] | ||
112 | 180 | |||
113 | 181 | if len(text1) < 8: | ||
114 | 182 | sign = icon_type | ||
115 | 183 | else: | ||
116 | 184 | sign = GOOD | ||
117 | 185 | label_text.append(sign % PASSWORD_LENGTH) | ||
118 | 186 | |||
119 | 187 | if re.search('[A-Z]', text1) is None: | ||
120 | 188 | sign = icon_type | ||
121 | 189 | else: | ||
122 | 190 | sign = GOOD | ||
123 | 191 | label_text.append(sign % PASSWORD_UPPER) | ||
124 | 192 | |||
125 | 193 | if re.search('[\d+]', text1) is None: | ||
126 | 194 | sign = icon_type | ||
127 | 195 | else: | ||
128 | 196 | sign = GOOD | ||
129 | 197 | label_text.append(sign % PASSWORD_DIGIT) | ||
130 | 198 | |||
131 | 199 | self.ui.password_assistance.setText("<br>".join(label_text)) | ||
132 | 200 | |||
133 | 201 | def password_check_match(self): | ||
134 | 202 | """Check if passwords match, otherwise show a message.""" | ||
135 | 203 | self.password_assistance() | ||
136 | 204 | label_text = unicode(self.ui.password_assistance.text()) | ||
137 | 205 | text1 = unicode(self.ui.password_edit.text()) | ||
138 | 206 | text2 = unicode(self.ui.confirm_password_edit.text()) | ||
139 | 207 | if text1 != text2: | ||
140 | 208 | label_text += "<br>" + BAD % PASSWORD_MATCH | ||
141 | 209 | self.ui.password_assistance.setText(label_text) | ||
142 | 210 | |||
143 | 211 | def password_default_assistance(self): | ||
144 | 212 | """Show default help for the password field.""" | ||
145 | 213 | label_text = ["<b>%s</b>" % PASSWORD_MUST_CONTAIN, ] | ||
146 | 214 | |||
147 | 215 | label_text.append(NORMAL % PASSWORD_LENGTH) | ||
148 | 216 | label_text.append(NORMAL % PASSWORD_UPPER) | ||
149 | 217 | label_text.append(NORMAL % PASSWORD_DIGIT) | ||
150 | 218 | |||
151 | 219 | self.ui.password_assistance.setText("<br>".join(label_text)) | ||
152 | 220 | |||
153 | 221 | def check_as_invalid(self, line_edit): | ||
154 | 222 | """Set QLineEdit's formError property as True, refresh the style.""" | ||
155 | 223 | line_edit.setProperty("formError", True) | ||
156 | 224 | line_edit.style().unpolish(line_edit) | ||
157 | 225 | line_edit.style().polish(line_edit) | ||
158 | 226 | |||
159 | 227 | def check_as_valid(self, line_edit): | ||
160 | 228 | """Set QLineEdit's formError property as False, refresh the style.""" | ||
161 | 229 | line_edit.setProperty("formError", False) | ||
162 | 230 | line_edit.style().unpolish(line_edit) | ||
163 | 231 | line_edit.style().polish(line_edit) | ||
165 | 232 | 176 | ||
166 | 233 | def showEvent(self, event): | 177 | def showEvent(self, event): |
167 | 234 | """Set set_up_button as default button when the page is shown.""" | 178 | """Set set_up_button as default button when the page is shown.""" |
168 | 235 | 179 | ||
169 | === modified file 'ubuntuone_installer/gui/qt/tests/test_setup_account.py' | |||
170 | --- ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-08-30 16:09:00 +0000 | |||
171 | +++ ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-06 15:25:05 +0000 | |||
172 | @@ -22,6 +22,8 @@ | |||
173 | 22 | 22 | ||
174 | 23 | from PyQt4 import QtGui, QtCore | 23 | from PyQt4 import QtGui, QtCore |
175 | 24 | 24 | ||
176 | 25 | from ubuntu_sso.qt import common | ||
177 | 26 | |||
178 | 25 | from ubuntuone_installer.gui.qt import gui, setup_account | 27 | from ubuntuone_installer.gui.qt import gui, setup_account |
179 | 26 | from ubuntuone_installer.gui.qt.tests import BaseTestCase | 28 | from ubuntuone_installer.gui.qt.tests import BaseTestCase |
180 | 27 | from ubuntuone_installer.gui.qt.ui import ( | 29 | from ubuntuone_installer.gui.qt.ui import ( |
181 | @@ -135,103 +137,6 @@ | |||
182 | 135 | setup_account.ERROR % setup_account.EMPTY_NAME) | 137 | setup_account.ERROR % setup_account.EMPTY_NAME) |
183 | 136 | self.ui.hide() | 138 | self.ui.hide() |
184 | 137 | 139 | ||
185 | 138 | def test_short_password(self): | ||
186 | 139 | """Status with short password. | ||
187 | 140 | |||
188 | 141 | * Password assistance contains the right message. | ||
189 | 142 | """ | ||
190 | 143 | self.ui.ui.password_edit.setText("foobar") | ||
191 | 144 | self.ui.password_assistance() | ||
192 | 145 | self.assertIn( | ||
193 | 146 | setup_account.BAD % setup_account.PASSWORD_LENGTH, | ||
194 | 147 | unicode(self.ui.ui.password_assistance.text()), | ||
195 | 148 | ) | ||
196 | 149 | |||
197 | 150 | def test_long_password(self): | ||
198 | 151 | """Status with long password. | ||
199 | 152 | |||
200 | 153 | * Password assistance contains the right message. | ||
201 | 154 | """ | ||
202 | 155 | self.ui.ui.password_edit.setText("foobarbaz") | ||
203 | 156 | self.ui.password_assistance() | ||
204 | 157 | self.assertIn( | ||
205 | 158 | setup_account.GOOD % setup_account.PASSWORD_LENGTH, | ||
206 | 159 | unicode(self.ui.ui.password_assistance.text()), | ||
207 | 160 | ) | ||
208 | 161 | |||
209 | 162 | def test_no_number_password(self): | ||
210 | 163 | """Status with password without a number. | ||
211 | 164 | |||
212 | 165 | * Password assistance contains the right message. | ||
213 | 166 | """ | ||
214 | 167 | self.ui.ui.password_edit.setText("foobarbaz") | ||
215 | 168 | self.ui.password_assistance() | ||
216 | 169 | self.assertIn( | ||
217 | 170 | setup_account.BAD % setup_account.PASSWORD_DIGIT, | ||
218 | 171 | unicode(self.ui.ui.password_assistance.text()), | ||
219 | 172 | ) | ||
220 | 173 | |||
221 | 174 | def test_number_password(self): | ||
222 | 175 | """Status with password with a number. | ||
223 | 176 | |||
224 | 177 | * Password assistance contains the right message. | ||
225 | 178 | """ | ||
226 | 179 | self.ui.ui.password_edit.setText("foobarba7") | ||
227 | 180 | self.ui.password_assistance() | ||
228 | 181 | self.assertIn( | ||
229 | 182 | setup_account.GOOD % setup_account.PASSWORD_DIGIT, | ||
230 | 183 | unicode(self.ui.ui.password_assistance.text()), | ||
231 | 184 | ) | ||
232 | 185 | |||
233 | 186 | def test_no_uppercase_password(self): | ||
234 | 187 | """Status with password without uppercase letters. | ||
235 | 188 | |||
236 | 189 | * Password assistance contains the right message. | ||
237 | 190 | """ | ||
238 | 191 | self.ui.ui.password_edit.setText("foobarbaz") | ||
239 | 192 | self.ui.password_assistance() | ||
240 | 193 | self.assertIn( | ||
241 | 194 | setup_account.BAD % setup_account.PASSWORD_UPPER, | ||
242 | 195 | unicode(self.ui.ui.password_assistance.text()), | ||
243 | 196 | ) | ||
244 | 197 | |||
245 | 198 | def test_upper_password(self): | ||
246 | 199 | """Status with password with uppercase letters. | ||
247 | 200 | |||
248 | 201 | * Password assistance contains the right message. | ||
249 | 202 | """ | ||
250 | 203 | self.ui.ui.password_edit.setText("Foobarba7") | ||
251 | 204 | self.ui.password_assistance() | ||
252 | 205 | self.assertIn( | ||
253 | 206 | setup_account.GOOD % setup_account.PASSWORD_UPPER, | ||
254 | 207 | unicode(self.ui.ui.password_assistance.text()), | ||
255 | 208 | ) | ||
256 | 209 | |||
257 | 210 | def test_matching_passwords(self): | ||
258 | 211 | """Status when the passwords match. | ||
259 | 212 | |||
260 | 213 | * Password assistance doesn't contain the message. | ||
261 | 214 | """ | ||
262 | 215 | self.ui.ui.password_edit.setText("Foobarba7") | ||
263 | 216 | self.ui.ui.confirm_password_edit.setText("Foobarba7") | ||
264 | 217 | self.ui.password_check_match() | ||
265 | 218 | self.assertNotIn( | ||
266 | 219 | setup_account.BAD % setup_account.PASSWORD_MATCH, | ||
267 | 220 | unicode(self.ui.ui.password_assistance.text())) | ||
268 | 221 | |||
269 | 222 | def test_not_matching_passwords(self): | ||
270 | 223 | """Status when the passwords not match. | ||
271 | 224 | |||
272 | 225 | * Password assistance contains the right message. | ||
273 | 226 | """ | ||
274 | 227 | self.ui.ui.password_edit.setText("Foobarba7") | ||
275 | 228 | self.ui.ui.confirm_password_edit.setText("BazBarFo0") | ||
276 | 229 | self.ui.password_check_match() | ||
277 | 230 | self.assertIn( | ||
278 | 231 | setup_account.BAD % setup_account.PASSWORD_MATCH, | ||
279 | 232 | unicode(self.ui.ui.password_assistance.text()), | ||
280 | 233 | ) | ||
281 | 234 | |||
282 | 235 | def test_password_default_assistance(self): | 140 | def test_password_default_assistance(self): |
283 | 236 | """Status when the password line edit receive focus and shows popup. | 141 | """Status when the password line edit receive focus and shows popup. |
284 | 237 | 142 | ||
285 | @@ -242,91 +147,15 @@ | |||
286 | 242 | self.ui.validate_data_on_focus_changed(4) | 147 | self.ui.validate_data_on_focus_changed(4) |
287 | 243 | self.ui.focus_changed(None, self.ui.ui.password_edit) | 148 | self.ui.focus_changed(None, self.ui.ui.password_edit) |
288 | 244 | self.assertIn( | 149 | self.assertIn( |
374 | 245 | setup_account.NORMAL % setup_account.PASSWORD_LENGTH, | 150 | common.NORMAL % common.PASSWORD_LENGTH, |
375 | 246 | unicode(self.ui.ui.password_assistance.text()), | 151 | unicode(self.ui.ui.password_assistance.text()), |
376 | 247 | ) | 152 | ) |
377 | 248 | self.assertIn( | 153 | self.assertIn( |
378 | 249 | setup_account.NORMAL % setup_account.PASSWORD_UPPER, | 154 | common.NORMAL % common.PASSWORD_UPPER, |
379 | 250 | unicode(self.ui.ui.password_assistance.text()), | 155 | unicode(self.ui.ui.password_assistance.text()), |
380 | 251 | ) | 156 | ) |
381 | 252 | self.assertIn( | 157 | self.assertIn( |
382 | 253 | setup_account.NORMAL % setup_account.PASSWORD_DIGIT, | 158 | common.NORMAL % common.PASSWORD_DIGIT, |
298 | 254 | unicode(self.ui.ui.password_assistance.text()), | ||
299 | 255 | ) | ||
300 | 256 | |||
301 | 257 | def test_password_assistance_in_focus_length_correct(self): | ||
302 | 258 | """Check the QLineEdit for password when the length is correct.""" | ||
303 | 259 | self.ui.ui.password_edit.setText("aaaaaaaaa") | ||
304 | 260 | self.ui.ui.confirm_password_edit.setText("") | ||
305 | 261 | self.ui.password_assistance(setup_account.NORMAL) | ||
306 | 262 | self.assertIn( | ||
307 | 263 | setup_account.GOOD % setup_account.PASSWORD_LENGTH, | ||
308 | 264 | unicode(self.ui.ui.password_assistance.text()), | ||
309 | 265 | ) | ||
310 | 266 | self.assertIn( | ||
311 | 267 | setup_account.NORMAL % setup_account.PASSWORD_UPPER, | ||
312 | 268 | unicode(self.ui.ui.password_assistance.text()), | ||
313 | 269 | ) | ||
314 | 270 | self.assertIn( | ||
315 | 271 | setup_account.NORMAL % setup_account.PASSWORD_DIGIT, | ||
316 | 272 | unicode(self.ui.ui.password_assistance.text()), | ||
317 | 273 | ) | ||
318 | 274 | |||
319 | 275 | def test_password_assistance_in_focus_with_upper(self): | ||
320 | 276 | """Check the QLineEdit for password when it has an upper case char.""" | ||
321 | 277 | self.ui.ui.password_edit.setText("AAa") | ||
322 | 278 | self.ui.ui.confirm_password_edit.setText("") | ||
323 | 279 | self.ui.password_assistance(setup_account.NORMAL) | ||
324 | 280 | self.assertIn( | ||
325 | 281 | setup_account.NORMAL % setup_account.PASSWORD_LENGTH, | ||
326 | 282 | unicode(self.ui.ui.password_assistance.text()), | ||
327 | 283 | ) | ||
328 | 284 | self.assertIn( | ||
329 | 285 | setup_account.GOOD % setup_account.PASSWORD_UPPER, | ||
330 | 286 | unicode(self.ui.ui.password_assistance.text()), | ||
331 | 287 | ) | ||
332 | 288 | self.assertIn( | ||
333 | 289 | setup_account.NORMAL % setup_account.PASSWORD_DIGIT, | ||
334 | 290 | unicode(self.ui.ui.password_assistance.text()), | ||
335 | 291 | ) | ||
336 | 292 | |||
337 | 293 | def test_password_assistance_in_focus_with_number(self): | ||
338 | 294 | """Check the QLineEdit for password when it contains numbers.""" | ||
339 | 295 | self.ui.ui.password_edit.setText("a123") | ||
340 | 296 | self.ui.ui.confirm_password_edit.setText("") | ||
341 | 297 | self.ui.password_assistance(setup_account.NORMAL) | ||
342 | 298 | self.assertIn( | ||
343 | 299 | setup_account.NORMAL % setup_account.PASSWORD_LENGTH, | ||
344 | 300 | unicode(self.ui.ui.password_assistance.text()), | ||
345 | 301 | ) | ||
346 | 302 | self.assertIn( | ||
347 | 303 | setup_account.NORMAL % setup_account.PASSWORD_UPPER, | ||
348 | 304 | unicode(self.ui.ui.password_assistance.text()), | ||
349 | 305 | ) | ||
350 | 306 | self.assertIn( | ||
351 | 307 | setup_account.GOOD % setup_account.PASSWORD_DIGIT, | ||
352 | 308 | unicode(self.ui.ui.password_assistance.text()), | ||
353 | 309 | ) | ||
354 | 310 | |||
355 | 311 | def test_password_assistance_in_focus_all_ok(self): | ||
356 | 312 | """Check the QLineEdit for password when all the condition are ok.""" | ||
357 | 313 | self.ui.ui.password_edit.setText("T3st3rqw") | ||
358 | 314 | self.ui.ui.confirm_password_edit.setText("T3st3rqw") | ||
359 | 315 | self.ui.password_assistance(setup_account.NORMAL) | ||
360 | 316 | self.assertIn( | ||
361 | 317 | setup_account.GOOD % setup_account.PASSWORD_LENGTH, | ||
362 | 318 | unicode(self.ui.ui.password_assistance.text()), | ||
363 | 319 | ) | ||
364 | 320 | self.assertIn( | ||
365 | 321 | setup_account.GOOD % setup_account.PASSWORD_UPPER, | ||
366 | 322 | unicode(self.ui.ui.password_assistance.text()), | ||
367 | 323 | ) | ||
368 | 324 | self.assertIn( | ||
369 | 325 | setup_account.GOOD % setup_account.PASSWORD_DIGIT, | ||
370 | 326 | unicode(self.ui.ui.password_assistance.text()), | ||
371 | 327 | ) | ||
372 | 328 | self.assertNotIn( | ||
373 | 329 | setup_account.NORMAL % setup_account.PASSWORD_MATCH, | ||
383 | 330 | unicode(self.ui.ui.password_assistance.text()), | 159 | unicode(self.ui.ui.password_assistance.text()), |
384 | 331 | ) | 160 | ) |
385 | 332 | 161 | ||
386 | @@ -343,16 +172,6 @@ | |||
387 | 343 | self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE) | 172 | self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE) |
388 | 344 | self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) | 173 | self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
389 | 345 | 174 | ||
390 | 346 | def test_check_valid(self): | ||
391 | 347 | """Check the propery value of a QLineEdit marked as valid.""" | ||
392 | 348 | self.ui.check_as_valid(self.ui.ui.name_edit) | ||
393 | 349 | self.assertFalse(self.ui.ui.name_edit.property("formError").toBool()) | ||
394 | 350 | |||
395 | 351 | def test_check_invalid(self): | ||
396 | 352 | """Check the propery value of a QLineEdit marked as invalid.""" | ||
397 | 353 | self.ui.check_as_invalid(self.ui.ui.name_edit) | ||
398 | 354 | self.assertTrue(self.ui.ui.name_edit.property("formError").toBool()) | ||
399 | 355 | |||
400 | 356 | def test_focus_changed_1(self): | 175 | def test_focus_changed_1(self): |
401 | 357 | """Check functions execution when focus_changed() is executed.""" | 176 | """Check functions execution when focus_changed() is executed.""" |
402 | 358 | self.patch(self.ui, 'validation_functions', FakeValidationDict()) | 177 | self.patch(self.ui, 'validation_functions', FakeValidationDict()) |
Needs this branch: https:/ /code.launchpad .net/~diegosarm entero/ ubuntu- sso-client/ reset-password