Merge lp:~ralsina/ubuntuone-windows-installer/fix_804352 into lp:ubuntuone-windows-installer

Proposed by Roberto Alsina
Status: Merged
Approved by: Shane Fagan
Approved revision: 23
Merged at revision: 13
Proposed branch: lp:~ralsina/ubuntuone-windows-installer/fix_804352
Merge into: lp:ubuntuone-windows-installer
Diff against target: 701 lines (+637/-5)
4 files modified
data/qt/setup_account.ui (+255/-0)
ubuntuone_installer/gui/qt/gui.py (+6/-5)
ubuntuone_installer/gui/qt/setup_account.py (+150/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+226/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-windows-installer/fix_804352
Reviewer Review Type Date Requested Status
Shane Fagan (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+66663@code.launchpad.net

Commit message

Bring "setup account" page up to spec.

Description of the change

Bring the page up to spec with design's proposal.

See these images for comparison:

https://bugs.launchpad.net/ubuntuone-windows-installer/+bug/804352/+attachment/2186610/+files/sing-up-mockup.png

https://bugs.launchpad.net/ubuntuone-windows-installer/+bug/804352/+attachment/2187175/+files/implemented_setup_account.png

To test IRL (Windows only):

On one terminal start ubuntu-sso-client
In another terminal, start the wizard from this branch:

set PYTHONPATH=..\ubuntuone-client;..\ubuntuone-control-panel;..\ubuntu-sso-client;.
python bin\ubuntuone-installer-qt

Go to the "setup a new account" page and try it.

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

Code looks great, but someone else will need to do windows testing.

review: Approve
23. By Roberto Alsina

Also check passwords when the confirm_password is edited

Revision history for this message
Shane Fagan (shanepatrickfagan) wrote :

Tested working perfect

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'data/qt/setup_account.ui'
2--- data/qt/setup_account.ui 1970-01-01 00:00:00 +0000
3+++ data/qt/setup_account.ui 2011-07-01 21:41:22 +0000
4@@ -0,0 +1,255 @@
5+<?xml version="1.0" encoding="UTF-8"?>
6+<ui version="4.0">
7+ <class>SetUpAccountPage</class>
8+ <widget class="QWizardPage" name="SetUpAccountPage">
9+ <property name="geometry">
10+ <rect>
11+ <x>0</x>
12+ <y>0</y>
13+ <width>482</width>
14+ <height>514</height>
15+ </rect>
16+ </property>
17+ <property name="windowTitle">
18+ <string>WizardPage</string>
19+ </property>
20+ <layout class="QVBoxLayout" name="verticalLayout">
21+ <item>
22+ <layout class="QGridLayout" name="gridLayout">
23+ <item row="0" column="0">
24+ <widget class="QLabel" name="password_info_label">
25+ <property name="sizePolicy">
26+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
27+ <horstretch>0</horstretch>
28+ <verstretch>0</verstretch>
29+ </sizepolicy>
30+ </property>
31+ <property name="text">
32+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
33+ </property>
34+ <property name="wordWrap">
35+ <bool>true</bool>
36+ </property>
37+ </widget>
38+ </item>
39+ <item row="1" column="0">
40+ <widget class="QLabel" name="name_label">
41+ <property name="text">
42+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
43+ </property>
44+ </widget>
45+ </item>
46+ <item row="2" column="0">
47+ <widget class="QLineEdit" name="name_edit">
48+ <property name="placeholderText">
49+ <string/>
50+ </property>
51+ </widget>
52+ </item>
53+ <item row="2" column="1">
54+ <widget class="QLabel" name="name_assistance">
55+ <property name="text">
56+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
57+ </property>
58+ </widget>
59+ </item>
60+ <item row="3" column="0">
61+ <widget class="QLabel" name="email_label">
62+ <property name="text">
63+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
64+ </property>
65+ </widget>
66+ </item>
67+ <item row="4" column="0">
68+ <widget class="QLineEdit" name="email_edit">
69+ <property name="placeholderText">
70+ <string/>
71+ </property>
72+ </widget>
73+ </item>
74+ <item row="4" column="1">
75+ <widget class="QLabel" name="email_assistance">
76+ <property name="text">
77+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
78+ </property>
79+ </widget>
80+ </item>
81+ <item row="5" column="0">
82+ <widget class="QLabel" name="confirm_email_label">
83+ <property name="text">
84+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
85+ </property>
86+ </widget>
87+ </item>
88+ <item row="6" column="0">
89+ <widget class="QLineEdit" name="confirm_email_edit">
90+ <property name="placeholderText">
91+ <string/>
92+ </property>
93+ </widget>
94+ </item>
95+ <item row="6" column="1">
96+ <widget class="QLabel" name="confirm_email_assistance">
97+ <property name="text">
98+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
99+ </property>
100+ </widget>
101+ </item>
102+ <item row="7" column="0">
103+ <widget class="QLabel" name="password_label">
104+ <property name="text">
105+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
106+ </property>
107+ </widget>
108+ </item>
109+ <item row="8" column="0">
110+ <widget class="QLineEdit" name="password_edit">
111+ <property name="toolTip">
112+ <string>Your password must be at least 8 characters long and at least contain one number and one upper later.</string>
113+ </property>
114+ <property name="statusTip">
115+ <string/>
116+ </property>
117+ <property name="echoMode">
118+ <enum>QLineEdit::Password</enum>
119+ </property>
120+ <property name="placeholderText">
121+ <string/>
122+ </property>
123+ </widget>
124+ </item>
125+ <item row="9" column="0">
126+ <widget class="QLabel" name="confirm_password_label">
127+ <property name="text">
128+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
129+ </property>
130+ </widget>
131+ </item>
132+ <item row="8" column="1" rowspan="3">
133+ <widget class="QLabel" name="password_assistance">
134+ <property name="text">
135+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
136+ </property>
137+ </widget>
138+ </item>
139+ <item row="10" column="0">
140+ <widget class="QLineEdit" name="confirm_password_edit">
141+ <property name="echoMode">
142+ <enum>QLineEdit::Password</enum>
143+ </property>
144+ <property name="placeholderText">
145+ <string/>
146+ </property>
147+ </widget>
148+ </item>
149+ <item row="11" column="0">
150+ <widget class="QLabel" name="captcha_view">
151+ <property name="sizePolicy">
152+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
153+ <horstretch>0</horstretch>
154+ <verstretch>0</verstretch>
155+ </sizepolicy>
156+ </property>
157+ <property name="minimumSize">
158+ <size>
159+ <width>300</width>
160+ <height>57</height>
161+ </size>
162+ </property>
163+ <property name="styleSheet">
164+ <string notr="true">background-color: white</string>
165+ </property>
166+ <property name="frameShape">
167+ <enum>QFrame::Box</enum>
168+ </property>
169+ <property name="text">
170+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
171+ </property>
172+ </widget>
173+ </item>
174+ <item row="11" column="1">
175+ <widget class="QLabel" name="refresh_label">
176+ <property name="sizePolicy">
177+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
178+ <horstretch>0</horstretch>
179+ <verstretch>0</verstretch>
180+ </sizepolicy>
181+ </property>
182+ <property name="locale">
183+ <locale language="English" country="UnitedStates"/>
184+ </property>
185+ <property name="text">
186+ <string>If you can't read this then &lt;a href=&quot;example.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;refresh&lt;/span&gt;&lt;/a&gt; this page&lt;/span&gt;</string>
187+ </property>
188+ <property name="wordWrap">
189+ <bool>true</bool>
190+ </property>
191+ </widget>
192+ </item>
193+ <item row="12" column="0" colspan="2">
194+ <widget class="QLineEdit" name="captcha_solution_edit">
195+ <property name="locale">
196+ <locale language="English" country="UnitedStates"/>
197+ </property>
198+ <property name="inputMask">
199+ <string/>
200+ </property>
201+ <property name="text">
202+ <string/>
203+ </property>
204+ <property name="placeholderText">
205+ <string/>
206+ </property>
207+ </widget>
208+ </item>
209+ </layout>
210+ </item>
211+ <item>
212+ <widget class="QCheckBox" name="terms_checkbox">
213+ <property name="text">
214+ <string>By signing up you agree blah blah</string>
215+ </property>
216+ </widget>
217+ </item>
218+ <item>
219+ <layout class="QHBoxLayout" name="horizontalLayout_4">
220+ <property name="spacing">
221+ <number>0</number>
222+ </property>
223+ <item>
224+ <widget class="QPushButton" name="terms_button">
225+ <property name="text">
226+ <string>Shw terms</string>
227+ </property>
228+ </widget>
229+ </item>
230+ <item>
231+ <spacer name="horizontalSpacer_3">
232+ <property name="orientation">
233+ <enum>Qt::Horizontal</enum>
234+ </property>
235+ <property name="sizeHint" stdset="0">
236+ <size>
237+ <width>40</width>
238+ <height>20</height>
239+ </size>
240+ </property>
241+ </spacer>
242+ </item>
243+ <item>
244+ <widget class="QPushButton" name="set_up_button">
245+ <property name="enabled">
246+ <bool>false</bool>
247+ </property>
248+ <property name="text">
249+ <string>Set Up Account</string>
250+ </property>
251+ </widget>
252+ </item>
253+ </layout>
254+ </item>
255+ </layout>
256+ </widget>
257+ <resources/>
258+ <connections/>
259+</ui>
260
261=== modified file 'ubuntuone_installer/gui/qt/gui.py'
262--- ubuntuone_installer/gui/qt/gui.py 2011-06-30 20:30:36 +0000
263+++ ubuntuone_installer/gui/qt/gui.py 2011-07-01 21:41:22 +0000
264@@ -33,7 +33,6 @@
265 ForgottenPasswordPage,
266 ResetPasswordPage,
267 TosPage,
268- SetupAccountPage,
269 )
270 from ubuntu_sso.qt.choose_sign_in_ui import \
271 Ui_ChooseSignInPage
272@@ -42,7 +41,6 @@
273 from ubuntu_sso.qt.email_verification_ui import \
274 Ui_EmailVerificationPage
275 from ubuntu_sso.qt.error_message_ui import Ui_ErrorPage
276-from ubuntu_sso.qt.setup_account_ui import Ui_SetUpAccountPage
277 from ubuntu_sso.qt.terms_and_conditions_ui import Ui_TosPage
278 from ubuntu_sso.qt.success_message_ui import Ui_SuccessPage
279 from ubuntu_sso.qt.forgotten_password_ui import \
280@@ -71,9 +69,11 @@
281 from ubuntuone_installer.gui.qt.ui import (
282 license_ui,
283 congratulations_ui,
284+ setup_account_ui
285 )
286 from ubuntuone_installer.gui.qt.local_folders import LocalFoldersPage
287 from ubuntuone_installer.gui.qt.sync_now_or_later import SyncNowOrLaterPage
288+from ubuntuone_installer.gui.qt.setup_account import SetupAccountPage
289
290 _ = gettext.gettext
291 SIGN_IN = _("Sign in to Ubuntu One")
292@@ -312,9 +312,10 @@
293 controller=self.sign_in_controller,
294 parent=self)
295 self.setup_controller = SetUpAccountController()
296- self.setup_account = SetupAccountPage(Ui_SetUpAccountPage(),
297- self.setup_controller,
298- parent=self)
299+ self.setup_account = SetupAccountPage(
300+ setup_account_ui.Ui_SetUpAccountPage(),
301+ self.setup_controller,
302+ parent=self)
303 self.tos = TosPage(Ui_TosPage(),
304 TosController(tos_url=TC_URL),
305 parent=self)
306
307=== added file 'ubuntuone_installer/gui/qt/setup_account.py'
308--- ubuntuone_installer/gui/qt/setup_account.py 1970-01-01 00:00:00 +0000
309+++ ubuntuone_installer/gui/qt/setup_account.py 2011-07-01 21:41:22 +0000
310@@ -0,0 +1,150 @@
311+# -*- coding: utf-8 -*-
312+
313+# Authors: Roberto Alsina <roberto.alsina@canonical.com>
314+#
315+# Copyright 2011 Canonical Ltd.
316+#
317+# This program is free software: you can redistribute it and/or modify it
318+# under the terms of the GNU General Public License version 3, as published
319+# by the Free Software Foundation.
320+#
321+# This program is distributed in the hope that it will be useful, but
322+# WITHOUT ANY WARRANTY; without even the implied warranties of
323+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
324+# PURPOSE. See the GNU General Public License for more details.
325+#
326+# You should have received a copy of the GNU General Public License along
327+# with this program. If not, see <http://www.gnu.org/licenses/>.
328+
329+"""Customized Setup Account page for SSO."""
330+
331+import gettext
332+import re
333+
334+from PyQt4 import QtGui
335+
336+from ubuntu_sso.qt import gui as sso_gui
337+
338+_ = gettext.gettext
339+
340+bad = u'<font color="red"> %s </font>'
341+good = u'<font color="green"> %s </font>'
342+
343+EMPTY_NAME = _("Please enter your name")
344+INVALID_EMAIL = _("Please enter a valid email address")
345+EMAIL_MATCH = _("The email addresses do not match")
346+PASSWORD_LENGTH = _("At least 8 characters")
347+PASSWORD_DIGIT = _("At least one number")
348+PASSWORD_UPPER = _("At least one uppercase letter")
349+PASSWORD_MATCH = _("Passwords don't match")
350+
351+
352+class SetupAccountPage(sso_gui.SetupAccountPage):
353+
354+ """Customized Setup Account page for SSO"""
355+
356+ def initializePage(self):
357+ """Setup UI details."""
358+ # We need to override some texts from SSO
359+ # to match our spec
360+ self.setTitle(_("Sign Up to Ubuntu One"))
361+ self.setSubTitle(_("You only need to set up your account "
362+ "once to get access to Ubuntu One across your devices."))
363+
364+ self.ui.name_label.setText(_("Name"))
365+ self.ui.email_label.setText(_("Email"))
366+ self.ui.confirm_email_label.setText(_("Retype email"))
367+ self.ui.password_label.setText(_("Create a password"))
368+ self.ui.confirm_password_label.setText(_("Retype password"))
369+ self.ui.terms_checkbox.setText(
370+ _("By signing up to Ubuntu One you agree to our Terms "
371+ "of Service and Privacy Policy"))
372+ self.ui.terms_button.setText(_("Show Terms of Service"))
373+ self.ui.password_info_label.hide()
374+
375+ # Button setup
376+ self.wizard().setButtonLayout([
377+ QtGui.QWizard.Stretch,
378+ QtGui.QWizard.BackButton,
379+ QtGui.QWizard.CancelButton,
380+ ])
381+
382+ self.ui.name_edit.textEdited.connect(self.name_assistance)
383+ self.name_assistance()
384+ self.ui.email_edit.textEdited.connect(self.email_assistance)
385+ self.ui.email_edit.textEdited.connect(self.confirm_email_assistance)
386+ self.email_assistance()
387+ self.ui.confirm_email_edit.textEdited.connect(
388+ self.confirm_email_assistance)
389+ self.confirm_email_assistance()
390+ self.ui.password_edit.textEdited.connect(self.password_assistance)
391+ self.ui.confirm_password_edit.textEdited.connect(self.password_assistance)
392+ self.password_assistance()
393+
394+ def name_assistance(self):
395+ text = unicode(self.ui.name_edit.text())
396+ if not text.strip():
397+ self.ui.name_assistance.setVisible(True)
398+ self.ui.name_assistance.setText(bad % EMPTY_NAME)
399+ else:
400+ self.ui.name_assistance.setVisible(False)
401+
402+ def email_assistance(self):
403+ text = unicode(self.ui.email_edit.text())
404+ if not is_correct_email(text):
405+ self.ui.email_assistance.setText(bad % INVALID_EMAIL)
406+ self.ui.email_assistance.setVisible(True)
407+ else:
408+ self.ui.email_assistance.setVisible(False)
409+
410+ def confirm_email_assistance(self):
411+ text1 = unicode(self.ui.email_edit.text())
412+ text2 = unicode(self.ui.confirm_email_edit.text())
413+ if text1 != text2:
414+ self.ui.confirm_email_assistance.setText(bad % EMAIL_MATCH)
415+ self.ui.confirm_email_assistance.setVisible(True)
416+ else:
417+ self.ui.confirm_email_assistance.setVisible(False)
418+
419+ def password_assistance(self):
420+ text1 = unicode(self.ui.password_edit.text())
421+ text2 = unicode(self.ui.confirm_password_edit.text())
422+ label_text = [_("Your password must contain"), ]
423+
424+ if len(text1) < 8:
425+ sign = bad
426+ else:
427+ sign = good
428+ label_text.append(sign % PASSWORD_LENGTH)
429+
430+ if re.search('[A-Z]', text1) is None:
431+ sign = bad
432+ else:
433+ sign = good
434+ label_text.append(sign % PASSWORD_UPPER)
435+
436+ if re.search('[\d+]', text1) is None:
437+ sign = bad
438+ else:
439+ sign = good
440+ label_text.append(sign % PASSWORD_DIGIT)
441+
442+ if text1 != text2:
443+ label_text.append(bad % PASSWORD_MATCH)
444+
445+ self.ui.password_assistance.setText("<br>".join(label_text))
446+
447+
448+def is_min_required_password(password):
449+ """Return if the password meets the minimum requirements."""
450+ if (len(password) < 8 or
451+ re.search('[A-Z]', password) is None or
452+ re.search('\d+', password) is None):
453+ return False
454+ return True
455+
456+
457+# FIXME: this should do the same check as SSO's server side
458+def is_correct_email(email_address):
459+ """Return if the email is correct."""
460+ return '@' in email_address
461
462=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
463--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-06-30 20:29:30 +0000
464+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-07-01 21:41:22 +0000
465@@ -38,6 +38,11 @@
466 from ubuntuone_installer.gui.qt.tests import BaseTestCase
467 from ubuntuone_installer.gui.qt.embedded_sso import UbuntuSSOClientGUI
468 from ubuntuone_installer.gui.qt import local_folders
469+from ubuntuone_installer.gui.qt import setup_account
470+from ubuntuone_installer.gui.qt.ui import (
471+ setup_account_ui
472+)
473+
474
475 TOKEN = {u'consumer_key': u'xQ7xDAz',
476 u'consumer_secret': u'KzCJWCTNbbntwfyCKKjomJDzlgqxLy',
477@@ -289,3 +294,224 @@
478 self.assertEqual(self._called, ((False,), {}))
479 self.ui.show_hide_offer(self.ui.quota() + 1)
480 self.assertEqual(self._called, ((True,), {}))
481+
482+
483+class SetupAccountTestCase(BaseTestCase):
484+ """Test the SetupAccountPage code."""
485+
486+ class_ui = setup_account.SetupAccountPage
487+ kwargs = dict(
488+ ui=setup_account_ui.Ui_SetUpAccountPage(),
489+ controller=FakeController(),
490+ parent=None,
491+ )
492+
493+ def setUp(self):
494+ """Initialize this test instance."""
495+ super(SetupAccountTestCase, self).setUp()
496+
497+ def test_empty_name(self):
498+ """Status when the name field is empty:
499+
500+ * Name Assistance label visible
501+ * Correct error message in it
502+ """
503+ self.ui.ui.name_edit.setText("")
504+ self.ui.name_assistance()
505+ self.ui.show()
506+ self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)
507+ self.assertEqual(
508+ unicode(self.ui.ui.name_assistance.text()),
509+ setup_account.bad % setup_account.EMPTY_NAME
510+ )
511+ self.ui.hide()
512+
513+ def test_blank_name(self):
514+ """Status when the name field is blank (spaces):
515+
516+ * Name Assistance label visible
517+ * Correct error message in it
518+ """
519+ self.ui.ui.name_edit.setText(" ")
520+ self.ui.name_assistance()
521+ self.ui.show()
522+ self.assertEqual(self.ui.ui.name_assistance.isVisible(), True)
523+ self.assertEqual(
524+ unicode(self.ui.ui.name_assistance.text()),
525+ setup_account.bad % setup_account.EMPTY_NAME
526+ )
527+ self.ui.hide()
528+
529+ def test_valid_name(self):
530+ """Status when the name field is valid:
531+
532+ * Name Assistance label invisible
533+ """
534+ self.ui.ui.name_edit.setText("John Doe")
535+ self.ui.name_assistance()
536+ self.ui.show()
537+ self.assertEqual(self.ui.ui.name_assistance.isVisible(), False)
538+ self.ui.hide()
539+
540+ def test_invalid_email(self):
541+ """Status when the email field has no @:
542+
543+ * Email Assistance label visible
544+ * Correct error message in it
545+ """
546+ self.ui.ui.email_edit.setText("foobar")
547+ self.ui.email_assistance()
548+ self.ui.show()
549+ self.assertEqual(self.ui.ui.email_assistance.isVisible(), True)
550+ self.assertEqual(
551+ unicode(self.ui.ui.email_assistance.text()),
552+ setup_account.bad % setup_account.INVALID_EMAIL
553+ )
554+ self.ui.hide()
555+
556+ def test_valid_email(self):
557+ """Status when the email field has a @:
558+
559+ * Email Assistance label invisible
560+ """
561+ self.ui.ui.email_edit.setText("foo@bar")
562+ self.ui.email_assistance()
563+ self.ui.show()
564+ self.assertEqual(self.ui.ui.email_assistance.isVisible(), False)
565+ self.ui.hide()
566+
567+ def test_matching_emails(self):
568+ """Status when the email fields match:
569+
570+ * Email Assistance label invisible
571+ """
572+ self.ui.ui.email_edit.setText("foo@bar")
573+ self.ui.ui.confirm_email_edit.setText("foo@bar")
574+ self.ui.confirm_email_assistance()
575+ self.ui.show()
576+ self.assertEqual(
577+ self.ui.ui.confirm_email_assistance.isVisible(), False)
578+ self.ui.hide()
579+
580+ def test_not_matching_emails(self):
581+ """Status when the email fields don't match:
582+
583+ * Email Assistance label visible
584+ * Correct error message
585+ """
586+ self.ui.ui.email_edit.setText("foo@bar")
587+ self.ui.ui.confirm_email_edit.setText("foo@baz")
588+ self.ui.confirm_email_assistance()
589+ self.ui.show()
590+ self.assertEqual(self.ui.ui.confirm_email_assistance.isVisible(), True)
591+ self.assertEqual(
592+ unicode(self.ui.ui.confirm_email_assistance.text()),
593+ setup_account.bad % setup_account.EMAIL_MATCH
594+ )
595+ self.ui.hide()
596+
597+ def test_short_password(self):
598+ """Status with short password:
599+
600+ * Password assistance contains the right message
601+ """
602+ self.ui.ui.password_edit.setText("foobar")
603+ self.ui.password_assistance()
604+ self.assertEqual(
605+ True,
606+ setup_account.bad % setup_account.PASSWORD_LENGTH in
607+ unicode(self.ui.ui.password_assistance.text()),
608+ )
609+
610+ def test_long_password(self):
611+ """Status with long password:
612+
613+ * Password assistance contains the right message
614+ """
615+ self.ui.ui.password_edit.setText("foobarbaz")
616+ self.ui.password_assistance()
617+ self.assertEqual(
618+ True,
619+ setup_account.good % setup_account.PASSWORD_LENGTH in
620+ unicode(self.ui.ui.password_assistance.text()),
621+ )
622+
623+ def test_no_number_password(self):
624+ """Status with password without a number:
625+
626+ * Password assistance contains the right message
627+ """
628+ self.ui.ui.password_edit.setText("foobarbaz")
629+ self.ui.password_assistance()
630+ self.assertEqual(
631+ True,
632+ setup_account.bad % setup_account.PASSWORD_DIGIT in
633+ unicode(self.ui.ui.password_assistance.text()),
634+ )
635+
636+ def test_number_password(self):
637+ """Status with password with a number:
638+
639+ * Password assistance contains the right message
640+ """
641+ self.ui.ui.password_edit.setText("foobarba7")
642+ self.ui.password_assistance()
643+ self.assertEqual(
644+ True,
645+ setup_account.good % setup_account.PASSWORD_DIGIT in
646+ unicode(self.ui.ui.password_assistance.text()),
647+ )
648+
649+ def test_no_uppercase_password(self):
650+ """Status with password without uppercase letters:
651+
652+ * Password assistance contains the right message
653+ """
654+ self.ui.ui.password_edit.setText("foobarbaz")
655+ self.ui.password_assistance()
656+ self.assertEqual(
657+ True,
658+ setup_account.bad % setup_account.PASSWORD_UPPER in
659+ unicode(self.ui.ui.password_assistance.text()),
660+ )
661+
662+ def test_upper_password(self):
663+ """Status with password with uppercase letters:
664+
665+ * Password assistance contains the right message
666+ """
667+ self.ui.ui.password_edit.setText("Foobarba7")
668+ self.ui.password_assistance()
669+ self.assertEqual(
670+ True,
671+ setup_account.good % setup_account.PASSWORD_UPPER in
672+ unicode(self.ui.ui.password_assistance.text()),
673+ )
674+
675+ def test_matching_passwords(self):
676+ """Status when the passwords match:
677+
678+ * Password assistance doesn't contain the message
679+ """
680+ self.ui.ui.password_edit.setText("Foobarba7")
681+ self.ui.ui.confirm_password_edit.setText("Foobarba7")
682+ self.ui.password_assistance()
683+ self.assertEqual(
684+ False,
685+ setup_account.PASSWORD_MATCH in
686+ unicode(self.ui.ui.password_assistance.text()),
687+ )
688+
689+ def test_not_matching_passwords(self):
690+ """Status when the passwords not match:
691+
692+ * Password assistance contains the right message
693+ """
694+ self.ui.ui.password_edit.setText("Foobarba7")
695+ self.ui.ui.confirm_password_edit.setText("BazBarFo0")
696+ self.ui.password_assistance()
697+ self.assertEqual(
698+ True,
699+ setup_account.bad % setup_account.PASSWORD_MATCH in
700+ unicode(self.ui.ui.password_assistance.text()),
701+ )

Subscribers

People subscribed via source and target branches