Merge lp:~diegosarmentero/ubuntu-sso-client/show-errors into lp:ubuntu-sso-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 900
Merged at revision: 893
Proposed branch: lp:~diegosarmentero/ubuntu-sso-client/show-errors
Merge into: lp:ubuntu-sso-client
Diff against target: 1151 lines (+381/-301)
18 files modified
data/qt/setup_account.ui (+246/-268)
data/qt/stylesheet.qss (+9/-1)
ubuntu_sso/qt/__init__.py (+1/-1)
ubuntu_sso/qt/current_user_sign_in_page.py (+3/-3)
ubuntu_sso/qt/email_verification_page.py (+2/-1)
ubuntu_sso/qt/enhanced_check_box.py (+1/-1)
ubuntu_sso/qt/forgotten_password_page.py (+3/-1)
ubuntu_sso/qt/main.py (+4/-0)
ubuntu_sso/qt/reset_password_page.py (+2/-3)
ubuntu_sso/qt/setup_account_page.py (+4/-5)
ubuntu_sso/qt/sso_wizard_page.py (+34/-9)
ubuntu_sso/qt/tests/test_current_user_sign_in_page.py (+8/-2)
ubuntu_sso/qt/tests/test_email_verification.py (+7/-1)
ubuntu_sso/qt/tests/test_forgotten_password.py (+8/-2)
ubuntu_sso/qt/tests/test_reset_password.py (+3/-0)
ubuntu_sso/qt/tests/test_setup_account.py (+3/-1)
ubuntu_sso/qt/tests/test_sso_wizard_page.py (+39/-0)
ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py (+4/-2)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntu-sso-client/show-errors
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+94617@code.launchpad.net

Commit message

- Fix: [UIFe] Improve the display of errors in the Qt UI (LP: #938604).
- Fix: Qt UI: center when first opening (LP: #934173).

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

I'm getting all these:

== Python Lint Notices ==

ubuntu_sso/qt/current_user_sign_in_page.py:
    158: [E1121, CurrentUserSignInPage.on_login_error] Too many positional arguments for function call

ubuntu_sso/qt/email_verification_page.py:
    135: [E1121, EmailVerificationPage.on_email_validation_error] Too many positional arguments for function call

ubuntu_sso/qt/forgotten_password_page.py:
    189: [E1121, ForgottenPasswordPage.on_password_reset_error] Too many positional arguments for function call

ubuntu_sso/qt/reset_password_page.py:
    183: [E1121, ResetPasswordPage.on_password_change_error] Too many positional arguments for function call

ubuntu_sso/qt/setup_account_page.py:
    350: [E1121, SetupAccountPage.on_user_registration_error] Too many positional arguments for function call
    391: [E1121, SetupAccountPage.validate_form] Too many positional arguments for function call

nessita@dali:~/canonical/ussoc/review_show-errors$

review: Needs Fixing
890. By Diego Sarmentero

Fixing lint issues

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> I'm getting all these:
>
> == Python Lint Notices ==
>
> ubuntu_sso/qt/current_user_sign_in_page.py:
> 158: [E1121, CurrentUserSignInPage.on_login_error] Too many positional
> arguments for function call
>
> ubuntu_sso/qt/email_verification_page.py:
> 135: [E1121, EmailVerificationPage.on_email_validation_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/forgotten_password_page.py:
> 189: [E1121, ForgottenPasswordPage.on_password_reset_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/reset_password_page.py:
> 183: [E1121, ResetPasswordPage.on_password_change_error] Too many
> positional arguments for function call
>
> ubuntu_sso/qt/setup_account_page.py:
> 350: [E1121, SetupAccountPage.on_user_registration_error] Too many
> positional arguments for function call
> 391: [E1121, SetupAccountPage.validate_form] Too many positional
> arguments for function call
>
> nessita@dali:~/canonical/ussoc/review_show-errors$

Fixed, forgot to push that.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Branch looks good!

* One tiny note: in current_user_sign_in_page.py, cleanupPage should not call self.hide_error() but super() instead.

* Instead of using assertTrue(foo >= bar), can you please ise assertGreaterEqual?

* Can you please restore the removed empty line in ubuntu_sso_wizard.py?

Thanks!

review: Needs Fixing
891. By Diego Sarmentero

Fixing some minor details.

892. By Diego Sarmentero

Changing the style and location of the errors.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Please do not increase the sso dialog size since we're already above the limit (limit is 525).

So, instead, remove the padding a bit, since there is too much white space between the header and the "Name" legend. Do not worry for the padding for the warning label.

Thanks!

review: Needs Fixing
893. By Diego Sarmentero

Fixing size, and adding ellipsis to the error message.

894. By Diego Sarmentero

Improves in the ui style.

895. By Diego Sarmentero

Some modifications in the setup_account_page_ui padding and spaces.

896. By Diego Sarmentero

Conflict resolve

897. By Diego Sarmentero

Conflict resolved.

898. By Diego Sarmentero

fixing setup_page

899. By Diego Sarmentero

improves in setup_account_page

900. By Diego Sarmentero

Fixing errors reset when the user restart request again some data.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

Thanks for working on this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/qt/setup_account.ui'
--- data/qt/setup_account.ui 2012-02-23 20:28:00 +0000
+++ data/qt/setup_account.ui 2012-03-01 20:49:18 +0000
@@ -7,7 +7,7 @@
7 <x>0</x>7 <x>0</x>
8 <y>0</y>8 <y>0</y>
9 <width>543</width>9 <width>543</width>
10 <height>514</height>10 <height>476</height>
11 </rect>11 </rect>
12 </property>12 </property>
13 <property name="sizePolicy">13 <property name="sizePolicy">
@@ -39,24 +39,27 @@
39 <number>0</number>39 <number>0</number>
40 </property>40 </property>
41 <item>41 <item>
42 <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,220">42 <layout class="QGridLayout" name="gridLayout" columnminimumwidth="310,0">
43 <property name="sizeConstraint">
44 <enum>QLayout::SetDefaultConstraint</enum>
45 </property>
46 <item row="1" column="1">
47 <spacer name="verticalSpacer">
48 <property name="orientation">
49 <enum>Qt::Vertical</enum>
50 </property>
51 <property name="sizeType">
52 <enum>QSizePolicy::Fixed</enum>
53 </property>
54 <property name="sizeHint" stdset="0">
55 <size>
56 <width>20</width>
57 <height>15</height>
58 </size>
59 </property>
60 </spacer>
61 </item>
43 <item row="0" column="0">62 <item row="0" column="0">
44 <widget class="QLabel" name="password_info_label">
45 <property name="sizePolicy">
46 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
47 <horstretch>0</horstretch>
48 <verstretch>0</verstretch>
49 </sizepolicy>
50 </property>
51 <property name="text">
52 <string notr="true">password_info_label</string>
53 </property>
54 <property name="wordWrap">
55 <bool>true</bool>
56 </property>
57 </widget>
58 </item>
59 <item row="1" column="0">
60 <layout class="QVBoxLayout" name="verticalLayout">63 <layout class="QVBoxLayout" name="verticalLayout">
61 <property name="spacing">64 <property name="spacing">
62 <number>3</number>65 <number>3</number>
@@ -106,7 +109,7 @@
106 </item>109 </item>
107 </layout>110 </layout>
108 </item>111 </item>
109 <item row="3" column="0">112 <item row="2" column="0">
110 <layout class="QVBoxLayout" name="verticalLayout">113 <layout class="QVBoxLayout" name="verticalLayout">
111 <property name="spacing">114 <property name="spacing">
112 <number>3</number>115 <number>3</number>
@@ -159,7 +162,48 @@
159 </item>162 </item>
160 </layout>163 </layout>
161 </item>164 </item>
162 <item row="4" column="0">165 <item row="2" column="1">
166 <layout class="QVBoxLayout" name="verticalLayout_8">
167 <property name="spacing">
168 <number>0</number>
169 </property>
170 <property name="leftMargin">
171 <number>0</number>
172 </property>
173 <item>
174 <widget class="QLabel" name="email_assistance">
175 <property name="sizePolicy">
176 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
177 <horstretch>0</horstretch>
178 <verstretch>0</verstretch>
179 </sizepolicy>
180 </property>
181 <property name="minimumSize">
182 <size>
183 <width>220</width>
184 <height>0</height>
185 </size>
186 </property>
187 <property name="maximumSize">
188 <size>
189 <width>220</width>
190 <height>16777215</height>
191 </size>
192 </property>
193 <property name="text">
194 <string notr="true">email_assistance</string>
195 </property>
196 <property name="alignment">
197 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
198 </property>
199 <property name="wordWrap">
200 <bool>true</bool>
201 </property>
202 </widget>
203 </item>
204 </layout>
205 </item>
206 <item row="3" column="0">
163 <layout class="QVBoxLayout" name="verticalLayout">207 <layout class="QVBoxLayout" name="verticalLayout">
164 <property name="spacing">208 <property name="spacing">
165 <number>3</number>209 <number>3</number>
@@ -212,28 +256,139 @@
212 </item>256 </item>
213 </layout>257 </layout>
214 </item>258 </item>
215 <item row="6" column="0">259 <item row="3" column="1">
260 <layout class="QVBoxLayout" name="verticalLayout_9">
261 <property name="spacing">
262 <number>0</number>
263 </property>
264 <property name="leftMargin">
265 <number>0</number>
266 </property>
267 <item>
268 <widget class="QLabel" name="confirm_email_assistance">
269 <property name="sizePolicy">
270 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
271 <horstretch>0</horstretch>
272 <verstretch>0</verstretch>
273 </sizepolicy>
274 </property>
275 <property name="minimumSize">
276 <size>
277 <width>220</width>
278 <height>0</height>
279 </size>
280 </property>
281 <property name="maximumSize">
282 <size>
283 <width>220</width>
284 <height>16777215</height>
285 </size>
286 </property>
287 <property name="text">
288 <string notr="true">confirm_email_assistance</string>
289 </property>
290 <property name="alignment">
291 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
292 </property>
293 <property name="wordWrap">
294 <bool>true</bool>
295 </property>
296 <property name="indent">
297 <number>0</number>
298 </property>
299 </widget>
300 </item>
301 </layout>
302 </item>
303 <item row="4" column="1">
304 <spacer name="verticalSpacer_2">
305 <property name="orientation">
306 <enum>Qt::Vertical</enum>
307 </property>
308 <property name="sizeType">
309 <enum>QSizePolicy::Fixed</enum>
310 </property>
311 <property name="sizeHint" stdset="0">
312 <size>
313 <width>20</width>
314 <height>15</height>
315 </size>
316 </property>
317 </spacer>
318 </item>
319 <item row="9" column="1">
320 <spacer name="verticalSpacer_5">
321 <property name="orientation">
322 <enum>Qt::Vertical</enum>
323 </property>
324 <property name="sizeType">
325 <enum>QSizePolicy::Fixed</enum>
326 </property>
327 <property name="sizeHint" stdset="0">
328 <size>
329 <width>20</width>
330 <height>15</height>
331 </size>
332 </property>
333 </spacer>
334 </item>
335 <item row="10" column="0" colspan="2">
336 <layout class="QHBoxLayout" name="hlayout_check">
337 <property name="spacing">
338 <number>0</number>
339 </property>
340 <property name="topMargin">
341 <number>10</number>
342 </property>
343 </layout>
344 </item>
345 <item row="0" column="1">
346 <layout class="QVBoxLayout" name="verticalLayout_7">
347 <property name="spacing">
348 <number>0</number>
349 </property>
350 <property name="leftMargin">
351 <number>0</number>
352 </property>
353 <item>
354 <widget class="QLabel" name="name_assistance">
355 <property name="sizePolicy">
356 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
357 <horstretch>0</horstretch>
358 <verstretch>0</verstretch>
359 </sizepolicy>
360 </property>
361 <property name="minimumSize">
362 <size>
363 <width>220</width>
364 <height>0</height>
365 </size>
366 </property>
367 <property name="maximumSize">
368 <size>
369 <width>220</width>
370 <height>16777215</height>
371 </size>
372 </property>
373 <property name="text">
374 <string notr="true">name_assistance</string>
375 </property>
376 <property name="alignment">
377 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
378 </property>
379 <property name="wordWrap">
380 <bool>true</bool>
381 </property>
382 </widget>
383 </item>
384 </layout>
385 </item>
386 <item row="5" column="0">
216 <layout class="QVBoxLayout" name="verticalLayout">387 <layout class="QVBoxLayout" name="verticalLayout">
217 <property name="spacing">388 <property name="spacing">
218 <number>3</number>389 <number>3</number>
219 </property>390 </property>
220 <item>391 <item>
221 <spacer name="verticalSpacer_4">
222 <property name="orientation">
223 <enum>Qt::Vertical</enum>
224 </property>
225 <property name="sizeType">
226 <enum>QSizePolicy::Fixed</enum>
227 </property>
228 <property name="sizeHint" stdset="0">
229 <size>
230 <width>20</width>
231 <height>10</height>
232 </size>
233 </property>
234 </spacer>
235 </item>
236 <item>
237 <widget class="QLabel" name="password_label">392 <widget class="QLabel" name="password_label">
238 <property name="font">393 <property name="font">
239 <font>394 <font>
@@ -290,28 +445,47 @@
290 </item>445 </item>
291 </layout>446 </layout>
292 </item>447 </item>
293 <item row="7" column="0">448 <item row="5" column="1" rowspan="2">
449 <layout class="QHBoxLayout" name="horizontalLayout_3">
450 <item>
451 <widget class="QLabel" name="password_assistance">
452 <property name="sizePolicy">
453 <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
454 <horstretch>0</horstretch>
455 <verstretch>0</verstretch>
456 </sizepolicy>
457 </property>
458 <property name="minimumSize">
459 <size>
460 <width>220</width>
461 <height>80</height>
462 </size>
463 </property>
464 <property name="maximumSize">
465 <size>
466 <width>220</width>
467 <height>16777215</height>
468 </size>
469 </property>
470 <property name="text">
471 <string notr="true">password_assistance</string>
472 </property>
473 <property name="wordWrap">
474 <bool>true</bool>
475 </property>
476 <property name="indent">
477 <number>17</number>
478 </property>
479 </widget>
480 </item>
481 </layout>
482 </item>
483 <item row="6" column="0">
294 <layout class="QVBoxLayout" name="verticalLayout">484 <layout class="QVBoxLayout" name="verticalLayout">
295 <property name="spacing">485 <property name="spacing">
296 <number>3</number>486 <number>3</number>
297 </property>487 </property>
298 <item>488 <item>
299 <spacer name="verticalSpacer_5">
300 <property name="orientation">
301 <enum>Qt::Vertical</enum>
302 </property>
303 <property name="sizeType">
304 <enum>QSizePolicy::Fixed</enum>
305 </property>
306 <property name="sizeHint" stdset="0">
307 <size>
308 <width>20</width>
309 <height>10</height>
310 </size>
311 </property>
312 </spacer>
313 </item>
314 <item>
315 <widget class="QLabel" name="confirm_password_label">489 <widget class="QLabel" name="confirm_password_label">
316 <property name="font">490 <property name="font">
317 <font>491 <font>
@@ -362,7 +536,23 @@
362 </item>536 </item>
363 </layout>537 </layout>
364 </item>538 </item>
365 <item row="9" column="0">539 <item row="7" column="1">
540 <spacer name="verticalSpacer_3">
541 <property name="orientation">
542 <enum>Qt::Vertical</enum>
543 </property>
544 <property name="sizeType">
545 <enum>QSizePolicy::Fixed</enum>
546 </property>
547 <property name="sizeHint" stdset="0">
548 <size>
549 <width>20</width>
550 <height>15</height>
551 </size>
552 </property>
553 </spacer>
554 </item>
555 <item row="8" column="0">
366 <layout class="QVBoxLayout" name="verticalLayout">556 <layout class="QVBoxLayout" name="verticalLayout">
367 <property name="spacing">557 <property name="spacing">
368 <number>3</number>558 <number>3</number>
@@ -442,7 +632,7 @@
442 </item>632 </item>
443 </layout>633 </layout>
444 </item>634 </item>
445 <item row="9" column="1">635 <item row="8" column="1">
446 <widget class="QLabel" name="refresh_label">636 <widget class="QLabel" name="refresh_label">
447 <property name="sizePolicy">637 <property name="sizePolicy">
448 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">638 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -476,218 +666,6 @@
476 </property>666 </property>
477 </widget>667 </widget>
478 </item>668 </item>
479 <item row="1" column="1">
480 <layout class="QVBoxLayout" name="verticalLayout_7">
481 <property name="spacing">
482 <number>0</number>
483 </property>
484 <property name="leftMargin">
485 <number>0</number>
486 </property>
487 <item>
488 <widget class="QLabel" name="name_assistance">
489 <property name="sizePolicy">
490 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
491 <horstretch>0</horstretch>
492 <verstretch>0</verstretch>
493 </sizepolicy>
494 </property>
495 <property name="minimumSize">
496 <size>
497 <width>220</width>
498 <height>0</height>
499 </size>
500 </property>
501 <property name="maximumSize">
502 <size>
503 <width>220</width>
504 <height>16777215</height>
505 </size>
506 </property>
507 <property name="text">
508 <string notr="true">name_assistance</string>
509 </property>
510 <property name="alignment">
511 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
512 </property>
513 <property name="wordWrap">
514 <bool>true</bool>
515 </property>
516 </widget>
517 </item>
518 </layout>
519 </item>
520 <item row="3" column="1">
521 <layout class="QVBoxLayout" name="verticalLayout_8">
522 <property name="spacing">
523 <number>0</number>
524 </property>
525 <property name="leftMargin">
526 <number>0</number>
527 </property>
528 <item>
529 <widget class="QLabel" name="email_assistance">
530 <property name="sizePolicy">
531 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
532 <horstretch>0</horstretch>
533 <verstretch>0</verstretch>
534 </sizepolicy>
535 </property>
536 <property name="minimumSize">
537 <size>
538 <width>220</width>
539 <height>0</height>
540 </size>
541 </property>
542 <property name="maximumSize">
543 <size>
544 <width>220</width>
545 <height>16777215</height>
546 </size>
547 </property>
548 <property name="text">
549 <string notr="true">email_assistance</string>
550 </property>
551 <property name="alignment">
552 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
553 </property>
554 <property name="wordWrap">
555 <bool>true</bool>
556 </property>
557 </widget>
558 </item>
559 </layout>
560 </item>
561 <item row="4" column="1">
562 <layout class="QVBoxLayout" name="verticalLayout_9">
563 <property name="spacing">
564 <number>0</number>
565 </property>
566 <property name="leftMargin">
567 <number>0</number>
568 </property>
569 <item>
570 <widget class="QLabel" name="confirm_email_assistance">
571 <property name="sizePolicy">
572 <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
573 <horstretch>0</horstretch>
574 <verstretch>0</verstretch>
575 </sizepolicy>
576 </property>
577 <property name="minimumSize">
578 <size>
579 <width>220</width>
580 <height>0</height>
581 </size>
582 </property>
583 <property name="maximumSize">
584 <size>
585 <width>220</width>
586 <height>16777215</height>
587 </size>
588 </property>
589 <property name="text">
590 <string notr="true">confirm_email_assistance</string>
591 </property>
592 <property name="alignment">
593 <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
594 </property>
595 <property name="wordWrap">
596 <bool>true</bool>
597 </property>
598 <property name="indent">
599 <number>0</number>
600 </property>
601 </widget>
602 </item>
603 </layout>
604 </item>
605 <item row="6" column="1" rowspan="2">
606 <widget class="QLabel" name="password_assistance">
607 <property name="sizePolicy">
608 <sizepolicy hsizetype="Maximum" vsizetype="Minimum">
609 <horstretch>0</horstretch>
610 <verstretch>0</verstretch>
611 </sizepolicy>
612 </property>
613 <property name="minimumSize">
614 <size>
615 <width>220</width>
616 <height>100</height>
617 </size>
618 </property>
619 <property name="maximumSize">
620 <size>
621 <width>220</width>
622 <height>16777215</height>
623 </size>
624 </property>
625 <property name="text">
626 <string notr="true">password_assistance</string>
627 </property>
628 <property name="wordWrap">
629 <bool>true</bool>
630 </property>
631 <property name="indent">
632 <number>17</number>
633 </property>
634 </widget>
635 </item>
636 <item row="2" column="1">
637 <spacer name="verticalSpacer">
638 <property name="orientation">
639 <enum>Qt::Vertical</enum>
640 </property>
641 <property name="sizeType">
642 <enum>QSizePolicy::Fixed</enum>
643 </property>
644 <property name="sizeHint" stdset="0">
645 <size>
646 <width>20</width>
647 <height>15</height>
648 </size>
649 </property>
650 </spacer>
651 </item>
652 <item row="5" column="1">
653 <spacer name="verticalSpacer_2">
654 <property name="orientation">
655 <enum>Qt::Vertical</enum>
656 </property>
657 <property name="sizeType">
658 <enum>QSizePolicy::Fixed</enum>
659 </property>
660 <property name="sizeHint" stdset="0">
661 <size>
662 <width>20</width>
663 <height>15</height>
664 </size>
665 </property>
666 </spacer>
667 </item>
668 <item row="8" column="1">
669 <spacer name="verticalSpacer_3">
670 <property name="orientation">
671 <enum>Qt::Vertical</enum>
672 </property>
673 <property name="sizeType">
674 <enum>QSizePolicy::Fixed</enum>
675 </property>
676 <property name="sizeHint" stdset="0">
677 <size>
678 <width>20</width>
679 <height>15</height>
680 </size>
681 </property>
682 </spacer>
683 </item>
684 </layout>
685 </item>
686 <item>
687 <layout class="QHBoxLayout" name="hlayout_check">
688 <property name="spacing">
689 <number>0</number>
690 </property>
691 </layout>669 </layout>
692 </item>670 </item>
693 </layout>671 </layout>
694672
=== modified file 'data/qt/stylesheet.qss'
--- data/qt/stylesheet.qss 2012-02-29 14:00:12 +0000
+++ data/qt/stylesheet.qss 2012-03-01 20:49:18 +0000
@@ -15,6 +15,7 @@
1515
16QLabel#password_assistance {16QLabel#password_assistance {
17 border-image: url(":/balloon_shape.png");17 border-image: url(":/balloon_shape.png");
18 font-size: 12px;
18}19}
1920
20QLineEdit {21QLineEdit {
@@ -98,5 +99,12 @@
98}99}
99100
100QFrame#header {101QFrame#header {
101 padding: 10px;102 padding-top: 1px;
103 padding-bottom: 1px;
104}
105
106QLabel#form_errors {
107 font: bold 14px;
108 color: #df2d1f;
109 padding-bottom: 1px;
102}110}
103111
=== modified file 'ubuntu_sso/qt/__init__.py'
--- ubuntu_sso/qt/__init__.py 2012-02-23 20:16:46 +0000
+++ ubuntu_sso/qt/__init__.py 2012-03-01 20:49:18 +0000
@@ -21,7 +21,7 @@
2121
22ERROR_ALL = '__all__'22ERROR_ALL = '__all__'
23ERROR_MESSAGE = 'message'23ERROR_MESSAGE = 'message'
24PREFERED_UI_SIZE = {'width': 550, 'height': 530}24PREFERED_UI_SIZE = {'width': 550, 'height': 525}
2525
2626
27# Based on the gtk implementation27# Based on the gtk implementation
2828
=== modified file 'ubuntu_sso/qt/current_user_sign_in_page.py'
--- ubuntu_sso/qt/current_user_sign_in_page.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/current_user_sign_in_page.py 2012-03-01 20:49:18 +0000
@@ -91,6 +91,7 @@
9191
92 def cleanupPage(self):92 def cleanupPage(self):
93 """Reset the wizard buttons."""93 """Reset the wizard buttons."""
94 super(CurrentUserSignInPage, self).cleanupPage()
94 self.wizard().setButtonLayout([QtGui.QWizard.Stretch])95 self.wizard().setButtonLayout([QtGui.QWizard.Stretch])
9596
96 def _set_translated_strings(self):97 def _set_translated_strings(self):
@@ -134,6 +135,7 @@
134 else:135 else:
135 f = self.backend.login136 f = self.backend.login
136137
138 self.hide_error()
137 self.show_overlay()139 self.show_overlay()
138 error_handler = partial(self._handle_error, f, self.on_login_error)140 error_handler = partial(self._handle_error, f, self.on_login_error)
139 f(*args, reply_handler=NO_OP, error_handler=error_handler)141 f(*args, reply_handler=NO_OP, error_handler=error_handler)
@@ -143,9 +145,7 @@
143 # let the user know145 # let the user know
144 logger.error('Got error when login %s, error: %s',146 logger.error('Got error when login %s, error: %s',
145 self.app_name, error)147 self.app_name, error)
146 self.hide_overlay()148 self.show_error(self.app_name, build_general_error_message(error))
147 self.message_box.critical(self, self.app_name,
148 build_general_error_message(error))
149149
150 def on_logged_in(self, app_name, result):150 def on_logged_in(self, app_name, result):
151 """We managed to log in."""151 """We managed to log in."""
152152
=== modified file 'ubuntu_sso/qt/email_verification_page.py'
--- ubuntu_sso/qt/email_verification_page.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/email_verification_page.py 2012-03-01 20:49:18 +0000
@@ -106,6 +106,7 @@
106 logger.debug('EmailVerificationController.validate_email')106 logger.debug('EmailVerificationController.validate_email')
107 code = unicode(self.ui.verification_code_edit.text())107 code = unicode(self.ui.verification_code_edit.text())
108 args = (self.app_name, self.email, self.password, code)108 args = (self.app_name, self.email, self.password, code)
109 self.hide_error()
109 if self.ping_url:110 if self.ping_url:
110 f = self.backend.validate_email_and_ping111 f = self.backend.validate_email_and_ping
111 args = args + (self.ping_url,)112 args = args + (self.ping_url,)
@@ -128,7 +129,7 @@
128 """Signal thrown when there's a problem validating the email."""129 """Signal thrown when there's a problem validating the email."""
129 msg = error.pop(ERROR_EMAIL_TOKEN, '')130 msg = error.pop(ERROR_EMAIL_TOKEN, '')
130 msg += build_general_error_message(error)131 msg += build_general_error_message(error)
131 self.message_box.critical(self, self.app_name, msg)132 self.show_error(self.app_name, msg)
132133
133 #pylint: disable=C0103134 #pylint: disable=C0103
134 def initializePage(self):135 def initializePage(self):
135136
=== modified file 'ubuntu_sso/qt/enhanced_check_box.py'
--- ubuntu_sso/qt/enhanced_check_box.py 2012-02-16 18:40:41 +0000
+++ ubuntu_sso/qt/enhanced_check_box.py 2012-03-01 20:49:18 +0000
@@ -32,7 +32,7 @@
32 self.text_label.setOpenExternalLinks(True)32 self.text_label.setOpenExternalLinks(True)
33 padding = self.iconSize().width()33 padding = self.iconSize().width()
34 self.text_label.setStyleSheet("margin-top: -3px;"34 self.text_label.setStyleSheet("margin-top: -3px;"
35 "padding-left: {0}px;".format(padding))35 "padding-left: 2px;")
36 hbox.setContentsMargins(padding, 0, 0, 0)36 hbox.setContentsMargins(padding, 0, 0, 0)
37 hbox.addWidget(self.text_label)37 hbox.addWidget(self.text_label)
38 self.setLayout(hbox)38 self.setLayout(hbox)
3939
=== modified file 'ubuntu_sso/qt/forgotten_password_page.py'
--- ubuntu_sso/qt/forgotten_password_page.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/forgotten_password_page.py 2012-03-01 20:49:18 +0000
@@ -138,6 +138,7 @@
138138
139 def request_new_password(self):139 def request_new_password(self):
140 """Send the request password operation."""140 """Send the request password operation."""
141 self.hide_error()
141 args = (self.app_name, self.email_address)142 args = (self.app_name, self.email_address)
142 f = self.backend.request_password_reset_token143 f = self.backend.request_password_reset_token
143144
@@ -154,6 +155,7 @@
154155
155 def on_try_again(self):156 def on_try_again(self):
156 """Set back the widget to the initial state."""157 """Set back the widget to the initial state."""
158 self.hide_error()
157 self.try_again_widget.setVisible(False)159 self.try_again_widget.setVisible(False)
158 self.email_widget.setVisible(True)160 self.email_widget.setVisible(True)
159161
@@ -177,4 +179,4 @@
177 self.email_widget.setVisible(False)179 self.email_widget.setVisible(False)
178 self.forgotted_password_intro_label.setVisible(False)180 self.forgotted_password_intro_label.setVisible(False)
179 self.try_again_widget.setVisible(True)181 self.try_again_widget.setVisible(True)
180 self.message_box.critical(self, self.app_name, msg)182 self.show_error(self.app_name, msg)
181183
=== modified file 'ubuntu_sso/qt/main.py'
--- ubuntu_sso/qt/main.py 2012-02-24 17:22:32 +0000
+++ ubuntu_sso/qt/main.py 2012-03-01 20:49:18 +0000
@@ -40,5 +40,9 @@
4040
41 # Unused variable 'ui', pylint: disable=W061241 # Unused variable 'ui', pylint: disable=W0612
42 ui = UbuntuSSOClientGUI(close_callback=app.exit, **kwargs)42 ui = UbuntuSSOClientGUI(close_callback=app.exit, **kwargs)
43 style = QtGui.QStyle.alignedRect(
44 QtCore.Qt.LeftToRight, QtCore.Qt.AlignCenter,
45 ui.size(), app.desktop().availableGeometry())
46 ui.setGeometry(style)
43 ui.show()47 ui.show()
44 app.exec_()48 app.exec_()
4549
=== modified file 'ubuntu_sso/qt/reset_password_page.py'
--- ubuntu_sso/qt/reset_password_page.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/reset_password_page.py 2012-03-01 20:49:18 +0000
@@ -166,12 +166,11 @@
166 """Let the user know that there was an error."""166 """Let the user know that there was an error."""
167 logger.error('Got error changing password for %s, error: %s',167 logger.error('Got error changing password for %s, error: %s',
168 self.app_name, error)168 self.app_name, error)
169 self.hide_overlay()169 self.show_error(self.app_name, build_general_error_message(error))
170 self.message_box.critical(self, self.app_name,
171 build_general_error_message(error))
172170
173 def set_new_password(self):171 def set_new_password(self):
174 """Request a new password to be set."""172 """Request a new password to be set."""
173 self.hide_error()
175 email = unicode(self.wizard().forgotten.ui.email_line_edit.text())174 email = unicode(self.wizard().forgotten.ui.email_line_edit.text())
176 code = unicode(self.ui.reset_code_line_edit.text())175 code = unicode(self.ui.reset_code_line_edit.text())
177 password = unicode(self.ui.password_line_edit.text())176 password = unicode(self.ui.password_line_edit.text())
178177
=== modified file 'ubuntu_sso/qt/setup_account_page.py'
--- ubuntu_sso/qt/setup_account_page.py 2012-03-01 13:33:51 +0000
+++ ubuntu_sso/qt/setup_account_page.py 2012-03-01 20:49:18 +0000
@@ -144,7 +144,6 @@
144 self.ui.confirm_email_label.setText(RETYPE_EMAIL)144 self.ui.confirm_email_label.setText(RETYPE_EMAIL)
145 self.ui.password_label.setText(PASSWORD)145 self.ui.password_label.setText(PASSWORD)
146 self.ui.confirm_password_label.setText(RETYPE_PASSWORD)146 self.ui.confirm_password_label.setText(RETYPE_PASSWORD)
147 self.ui.password_info_label.hide()
148147
149 # Button setup148 # Button setup
150 self.wizard().setButtonLayout([149 self.wizard().setButtonLayout([
@@ -172,7 +171,6 @@
172 self.ui.password_label.setText(PASSWORD1_ENTRY)171 self.ui.password_label.setText(PASSWORD1_ENTRY)
173 self.ui.confirm_password_label.setText(PASSWORD2_ENTRY)172 self.ui.confirm_password_label.setText(PASSWORD2_ENTRY)
174 self.ui.password_edit.setToolTip(PASSWORD_HELP)173 self.ui.password_edit.setToolTip(PASSWORD_HELP)
175 self.ui.password_info_label.setText(PASSWORD_HELP)
176 self.ui.captcha_solution_edit.setPlaceholderText(174 self.ui.captcha_solution_edit.setPlaceholderText(
177 CAPTCHA_SOLUTION_ENTRY)175 CAPTCHA_SOLUTION_ENTRY)
178 link = CAPTCHA_RELOAD_LINK % {'reload_text': CAPTCHA_RELOAD_TEXT}176 link = CAPTCHA_RELOAD_LINK % {'reload_text': CAPTCHA_RELOAD_TEXT}
@@ -332,7 +330,7 @@
332 def on_captcha_generation_error(self, error, *args, **kwargs):330 def on_captcha_generation_error(self, error, *args, **kwargs):
333 """An error ocurred."""331 """An error ocurred."""
334 logger.debug('SetUpAccountPage.on_captcha_generation_error')332 logger.debug('SetUpAccountPage.on_captcha_generation_error')
335 self.message_box.critical(self, self.app_name, CAPTCHA_LOAD_ERROR)333 self.show_error(self.app_name, CAPTCHA_LOAD_ERROR)
336 self.on_captcha_refresh_complete()334 self.on_captcha_refresh_complete()
337335
338 def on_user_registration_error(self, app_name, error):336 def on_user_registration_error(self, app_name, error):
@@ -344,7 +342,7 @@
344 self.set_error_message(self.ui.email_assistance, msg)342 self.set_error_message(self.ui.email_assistance, msg)
345 error_msg = build_general_error_message(error)343 error_msg = build_general_error_message(error)
346 if error_msg:344 if error_msg:
347 self.message_box.critical(self, self.app_name, error_msg)345 self.show_error(self.app_name, error_msg)
348 self._refresh_captcha()346 self._refresh_captcha()
349347
350 def on_user_registered(self, app_name, result):348 def on_user_registered(self, app_name, result):
@@ -385,7 +383,7 @@
385 messages.append(CAPTCHA_REQUIRED_ERROR)383 messages.append(CAPTCHA_REQUIRED_ERROR)
386 if len(messages) > 0:384 if len(messages) > 0:
387 condition = False385 condition = False
388 self.message_box.critical(self, self.app_name, '\n'.join(messages))386 self.show_error(self.app_name, '\n'.join(messages))
389 return condition387 return condition
390388
391 def set_next_validation(self):389 def set_next_validation(self):
@@ -399,6 +397,7 @@
399 # validate the current info of the form, try to perform the action397 # validate the current info of the form, try to perform the action
400 # to register the user, and then move foward398 # to register the user, and then move foward
401 if self.validate_form():399 if self.validate_form():
400 self.hide_error()
402 args = (self.app_name, email, password, name, captcha_id,401 args = (self.app_name, email, password, name, captcha_id,
403 captcha_solution)402 captcha_solution)
404 f = self.backend.register_user403 f = self.backend.register_user
405404
=== modified file 'ubuntu_sso/qt/sso_wizard_page.py'
--- ubuntu_sso/qt/sso_wizard_page.py 2012-02-29 14:31:45 +0000
+++ ubuntu_sso/qt/sso_wizard_page.py 2012-03-01 20:49:18 +0000
@@ -26,7 +26,6 @@
26 QFontMetrics,26 QFontMetrics,
27 QHBoxLayout,27 QHBoxLayout,
28 QVBoxLayout,28 QVBoxLayout,
29 QMessageBox,
30 QStyle,29 QStyle,
31 QWizardPage,30 QWizardPage,
32 QLabel,31 QLabel,
@@ -50,7 +49,7 @@
50 super(Header, self).__init__()49 super(Header, self).__init__()
51 self.setObjectName('header')50 self.setObjectName('header')
52 vbox = QVBoxLayout(self)51 vbox = QVBoxLayout(self)
53 vbox.setContentsMargins(0, 0, 0, 10)52 vbox.setContentsMargins(0, 0, 0, 0)
54 self.title_label = QLabel()53 self.title_label = QLabel()
55 self.title_label.setWordWrap(True)54 self.title_label.setWordWrap(True)
56 self.title_label.setObjectName('title_label')55 self.title_label.setObjectName('title_label')
@@ -113,27 +112,48 @@
113 self.policy_url = kwargs.get('policy_url', '')112 self.policy_url = kwargs.get('policy_url', '')
114 self.help_text = kwargs.get('help_text', '')113 self.help_text = kwargs.get('help_text', '')
115114
115 # Set the error area
116 self.form_errors_label = QLabel(' ')
117 self.form_errors_label.setObjectName('form_errors')
118 self.form_errors_label.setAlignment(Qt.AlignBottom)
119 self.layout().insertWidget(0, self.form_errors_label)
120 # Set the header
116 self.header = Header()121 self.header = Header()
117 self.header.set_title(title='')122 self.header.set_title(title='')
118 self.header.set_subtitle(subtitle='')123 self.header.set_subtitle(subtitle='')
119 self.layout().insertWidget(0, self.header)124 self.layout().insertWidget(0, self.header)
120
121 self.message_box = QMessageBox
122 self._signals_receivers = {}125 self._signals_receivers = {}
123 self.backend = None126 self.backend = None
124127
128 self.layout().setAlignment(Qt.AlignLeft)
129
125 self.setup_page()130 self.setup_page()
126131
132 def show_error(self, app_name, message):
133 """Show an error message inside the page."""
134 self.hide_overlay()
135 fm = QFontMetrics(self.form_errors_label.font())
136 width = PREFERED_UI_SIZE['width'] * 0.95
137 elided_text = fm.elidedText(message, Qt.ElideRight, width)
138 self.form_errors_label.setText(elided_text)
139 self.form_errors_label.setToolTip(message)
140
141 def hide_error(self):
142 """Hide the label errors in the current page."""
143 # We actually want the label with one chat, because if it is an
144 # empty string, the height of the label is 0
145 self.form_errors_label.setText(' ')
146
147 def hide_overlay(self):
148 """Emit the signal to notify the upper container that ends loading."""
149 self.setEnabled(True)
150 self.processingFinished.emit()
151
127 def show_overlay(self):152 def show_overlay(self):
128 """Emit the signal to notify the upper container that is loading."""153 """Emit the signal to notify the upper container that is loading."""
129 self.setEnabled(False)154 self.setEnabled(False)
130 self.processingStarted.emit()155 self.processingStarted.emit()
131156
132 def hide_overlay(self):
133 """Emit the signal to notify the upper container that ends loading."""
134 self.setEnabled(True)
135 self.processingFinished.emit()
136
137 @defer.inlineCallbacks157 @defer.inlineCallbacks
138 def setup_page(self):158 def setup_page(self):
139 """Setup the widget components."""159 """Setup the widget components."""
@@ -145,6 +165,11 @@
145 self._connect_ui()165 self._connect_ui()
146166
147 # pylint: disable=C0103167 # pylint: disable=C0103
168
169 def cleanupPage(self):
170 """Hide the errors."""
171 self.hide_error()
172
148 def setTitle(self, title=''):173 def setTitle(self, title=''):
149 """Set the Wizard Page Title."""174 """Set the Wizard Page Title."""
150 self.header.set_title(title)175 self.header.set_title(title)
151176
=== modified file 'ubuntu_sso/qt/tests/test_current_user_sign_in_page.py'
--- ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/tests/test_current_user_sign_in_page.py 2012-03-01 20:49:18 +0000
@@ -111,6 +111,7 @@
111111
112 def test_login_with_ping(self):112 def test_login_with_ping(self):
113 """Test the login method."""113 """Test the login method."""
114 self.patch(self.ui, "hide_error", self._set_called)
114 email = 'valid@email'115 email = 'valid@email'
115 password = '123456'116 password = '123456'
116 self.ui.ui.email_edit.setText(email)117 self.ui.ui.email_edit.setText(email)
@@ -120,9 +121,12 @@
120 self.assertFalse(self.ui.isEnabled())121 self.assertFalse(self.ui.isEnabled())
121 self.assert_backend_called('login_and_ping',122 self.assert_backend_called('login_and_ping',
122 self.app_name, email, password, self.ping_url)123 self.app_name, email, password, self.ping_url)
124 expected = ((), {})
125 self.assertEqual(expected, self._called)
123126
124 def test_login_without_ping(self):127 def test_login_without_ping(self):
125 """Test the login method."""128 """Test the login method."""
129 self.patch(self.ui, "hide_error", self._set_called)
126 self.ui.ping_url = ''130 self.ui.ping_url = ''
127 email = 'valid@email'131 email = 'valid@email'
128 password = '123456'132 password = '123456'
@@ -133,15 +137,17 @@
133 self.assertFalse(self.ui.isEnabled())137 self.assertFalse(self.ui.isEnabled())
134 self.assert_backend_called('login',138 self.assert_backend_called('login',
135 self.app_name, email, password)139 self.app_name, email, password)
140 expected = ((), {})
141 self.assertEqual(expected, self._called)
136142
137 def test_on_login_error(self):143 def test_on_login_error(self):
138 """Test the on_login_error method."""144 """Test the on_login_error method."""
139 self.patch(self.ui.message_box, "critical", self._set_called)145 self.patch(self.ui, "show_error", self._set_called)
140 app_name = 'my_app'146 app_name = 'my_app'
141 self.ui.app_name = app_name147 self.ui.app_name = app_name
142 error = {'errtype': 'UserNotValidated'}148 error = {'errtype': 'UserNotValidated'}
143 self.ui.on_login_error(app_name, error)149 self.ui.on_login_error(app_name, error)
144 self.assertEqual(self._overlay_hide_counter, 1)150 self.assertEqual(self._overlay_hide_counter, 0)
145 self.assertTrue(self.ui.isEnabled())151 self.assertTrue(self.ui.isEnabled())
146 expected = ((self.ui, 'my_app', ''), {})152 expected = ((self.ui, 'my_app', ''), {})
147 self.assertTrue(expected, self._called)153 self.assertTrue(expected, self._called)
148154
=== modified file 'ubuntu_sso/qt/tests/test_email_verification.py'
--- ubuntu_sso/qt/tests/test_email_verification.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/tests/test_email_verification.py 2012-03-01 20:49:18 +0000
@@ -99,7 +99,7 @@
9999
100 def test_on_email_validation_error(self):100 def test_on_email_validation_error(self):
101 """Test the validate_email method."""101 """Test the validate_email method."""
102 self.patch(self.ui.message_box, "critical", self._set_called)102 self.patch(self.ui, "show_error", self._set_called)
103 app_name = 'my_app'103 app_name = 'my_app'
104 error = {email_verification_page: 'error in email_verification_page'}104 error = {email_verification_page: 'error in email_verification_page'}
105 self.ui.on_email_validation_error(app_name, error)105 self.ui.on_email_validation_error(app_name, error)
@@ -122,6 +122,7 @@
122122
123 def test_validate_email_with_ping(self):123 def test_validate_email_with_ping(self):
124 """Test the login method."""124 """Test the login method."""
125 self.patch(self.ui, "hide_error", self._set_called)
125 email = 'email@example.com'126 email = 'email@example.com'
126 password = 'password'127 password = 'password'
127 code = 'code'128 code = 'code'
@@ -133,9 +134,12 @@
133134
134 self.assert_backend_called('validate_email_and_ping',135 self.assert_backend_called('validate_email_and_ping',
135 self.app_name, email, password, code, self.ping_url)136 self.app_name, email, password, code, self.ping_url)
137 expected = ((), {})
138 self.assertEqual(expected, self._called)
136139
137 def test_validate_email_without_ping(self):140 def test_validate_email_without_ping(self):
138 """Test the login method."""141 """Test the login method."""
142 self.patch(self.ui, "hide_error", self._set_called)
139 self.ui.ping_url = ''143 self.ui.ping_url = ''
140 email = 'email@example.com'144 email = 'email@example.com'
141 password = 'password'145 password = 'password'
@@ -148,3 +152,5 @@
148152
149 self.assert_backend_called('validate_email',153 self.assert_backend_called('validate_email',
150 self.app_name, email, password, code)154 self.app_name, email, password, code)
155 expected = ((), {})
156 self.assertEqual(expected, self._called)
151157
=== modified file 'ubuntu_sso/qt/tests/test_forgotten_password.py'
--- ubuntu_sso/qt/tests/test_forgotten_password.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/tests/test_forgotten_password.py 2012-03-01 20:49:18 +0000
@@ -85,9 +85,12 @@
8585
86 def test_send_button_clicked(self):86 def test_send_button_clicked(self):
87 """Test the send_button property."""87 """Test the send_button property."""
88 self.patch(self.ui, "hide_error", self._set_called)
88 self.ui.send_button.clicked.emit(True)89 self.ui.send_button.clicked.emit(True)
89 self.assert_backend_called('request_password_reset_token',90 self.assert_backend_called('request_password_reset_token',
90 self.app_name, '')91 self.app_name, '')
92 expected = ((), {})
93 self.assertEqual(expected, self._called)
9194
92 def test_try_again_widget(self):95 def test_try_again_widget(self):
93 """Test the try_again_widget property."""96 """Test the try_again_widget property."""
@@ -157,11 +160,14 @@
157160
158 def test_on_try_again(self):161 def test_on_try_again(self):
159 """Test on_try_again method."""162 """Test on_try_again method."""
163 self.patch(self.ui, "hide_error", self._set_called)
160 self.ui.show()164 self.ui.show()
161 self.addCleanup(self.ui.hide)165 self.addCleanup(self.ui.hide)
162 self.ui.on_try_again()166 self.ui.on_try_again()
163 self.assertTrue(self.ui.email_widget.isVisible())167 self.assertTrue(self.ui.email_widget.isVisible())
164 self.assertFalse(self.ui.try_again_widget.isVisible())168 self.assertFalse(self.ui.try_again_widget.isVisible())
169 expected = ((), {})
170 self.assertEqual(expected, self._called)
165171
166 def test_on_password_reset_token_sent(self):172 def test_on_password_reset_token_sent(self):
167 """Test on_password_reset_token_sent method."""173 """Test on_password_reset_token_sent method."""
@@ -177,7 +183,7 @@
177183
178 def test_on_password_reset_error(self):184 def test_on_password_reset_error(self):
179 """Test on_password_reset_error method."""185 """Test on_password_reset_error method."""
180 self.patch(self.ui.message_box, "critical", self._set_called)186 self.patch(self.ui, "show_error", self._set_called)
181 app_name = 'my_app'187 app_name = 'my_app'
182 error = {'errtype': 'AnotherError'}188 error = {'errtype': 'AnotherError'}
183 self.ui.show()189 self.ui.show()
@@ -194,7 +200,7 @@
194200
195 def test_on_password_reset_error_with_token_error(self):201 def test_on_password_reset_error_with_token_error(self):
196 """Test on_password_reset_error method."""202 """Test on_password_reset_error method."""
197 self.patch(self.ui.message_box, "critical", self._set_called)203 self.patch(self.ui, "show_error", self._set_called)
198 app_name = 'my_app'204 app_name = 'my_app'
199 error = {'errtype': 'ResetPasswordTokenError'}205 error = {'errtype': 'ResetPasswordTokenError'}
200 self.ui.on_password_reset_error(app_name, error)206 self.ui.on_password_reset_error(app_name, error)
201207
=== modified file 'ubuntu_sso/qt/tests/test_reset_password.py'
--- ubuntu_sso/qt/tests/test_reset_password.py 2012-02-23 19:49:02 +0000
+++ ubuntu_sso/qt/tests/test_reset_password.py 2012-03-01 20:49:18 +0000
@@ -128,6 +128,7 @@
128128
129 def test_set_new_password(self):129 def test_set_new_password(self):
130 """Test set_new_password method."""130 """Test set_new_password method."""
131 self.patch(self.ui, "hide_error", self._set_called)
131 email = 'email@example.com'132 email = 'email@example.com'
132 code = 'code'133 code = 'code'
133 password = 'password'134 password = 'password'
@@ -141,3 +142,5 @@
141142
142 self.assert_backend_called('set_new_password',143 self.assert_backend_called('set_new_password',
143 self.app_name, email, code, password)144 self.app_name, email, code, password)
145 expected = ((), {})
146 self.assertEqual(expected, self._called)
144147
=== modified file 'ubuntu_sso/qt/tests/test_setup_account.py'
--- ubuntu_sso/qt/tests/test_setup_account.py 2012-02-29 14:00:12 +0000
+++ ubuntu_sso/qt/tests/test_setup_account.py 2012-03-01 20:49:18 +0000
@@ -152,6 +152,7 @@
152 def test_on_user_registered(self):152 def test_on_user_registered(self):
153 """Test on_user_registered method."""153 """Test on_user_registered method."""
154 self.patch(self.ui, "validate_form", lambda: True)154 self.patch(self.ui, "validate_form", lambda: True)
155 self.patch(self.ui, "hide_error", self._set_called)
155156
156 email = 'email@example'157 email = 'email@example'
157 password = 'password'158 password = 'password'
@@ -176,6 +177,8 @@
176 self.assert_backend_called('register_user',177 self.assert_backend_called('register_user',
177 self.app_name, email, password, name, captcha_id,178 self.app_name, email, password, name, captcha_id,
178 captcha_solution)179 captcha_solution)
180 expected = ((), {})
181 self.assertEqual(expected, self._called)
179182
180 def test_set_next_validation(self):183 def test_set_next_validation(self):
181 """Test on_user_registered method."""184 """Test on_user_registered method."""
@@ -238,7 +241,6 @@
238 setup_account_page.PASSWORD)241 setup_account_page.PASSWORD)
239 self.assertEqual(self.ui.ui.confirm_password_label.text(),242 self.assertEqual(self.ui.ui.confirm_password_label.text(),
240 setup_account_page.RETYPE_PASSWORD)243 setup_account_page.RETYPE_PASSWORD)
241 self.assertFalse(self.ui.ui.password_info_label.isVisible())
242244
243 # assistants245 # assistants
244 self.assertFalse(self.ui.ui.name_assistance.isVisible())246 self.assertFalse(self.ui.ui.name_assistance.isVisible())
245247
=== modified file 'ubuntu_sso/qt/tests/test_sso_wizard_page.py'
--- ubuntu_sso/qt/tests/test_sso_wizard_page.py 2012-02-24 15:52:33 +0000
+++ ubuntu_sso/qt/tests/test_sso_wizard_page.py 2012-03-01 20:49:18 +0000
@@ -19,6 +19,7 @@
19from twisted.internet import defer19from twisted.internet import defer
2020
21from ubuntu_sso.qt import PREFERED_UI_SIZE21from ubuntu_sso.qt import PREFERED_UI_SIZE
22from ubuntu_sso.qt.setup_account_page import SetupAccountPage
22from ubuntu_sso.qt.sso_wizard_page import Header23from ubuntu_sso.qt.sso_wizard_page import Header
23from ubuntu_sso.qt.tests import BaseTestCase24from ubuntu_sso.qt.tests import BaseTestCase
2425
@@ -81,3 +82,41 @@
81 """Check if the widget is hidden for empty subtitle."""82 """Check if the widget is hidden for empty subtitle."""
82 self.header.set_title('')83 self.header.set_title('')
83 self.assertFalse(self.header.title_label.isVisible())84 self.assertFalse(self.header.title_label.isVisible())
85
86
87class SSOWizardPageTest(BaseTestCase):
88
89 """Tests for SSOWizardPage."""
90
91 @defer.inlineCallbacks
92 def setUp(self):
93 yield super(SSOWizardPageTest, self).setUp()
94 self.app_name = 'app_name'
95 # We need to choose some specific page to test SSOWizardPage,
96 # because the __init__ of SSOWizardPage fails by its own.
97 self.sso_wizard_page = SetupAccountPage(self.app_name)
98
99 def test_show_error(self):
100 """Test show_error with a normal length string."""
101 message = 'error-message'
102 self.sso_wizard_page.show_error(self.app_name, message)
103 self.assertEqual(
104 self.sso_wizard_page.form_errors_label.toolTip(), message)
105 expected = unicode(self.sso_wizard_page.form_errors_label.text())
106 self.assertEqual(expected, message)
107
108 def test_show_error_long_text(self):
109 """Test show_error with a long length string."""
110 message = 'a' * int(PREFERED_UI_SIZE['width'] * 0.95) + 'a'
111 self.sso_wizard_page.show_error(self.app_name, message)
112 self.assertEqual(
113 self.sso_wizard_page.form_errors_label.toolTip(), message)
114 expected = unicode(self.sso_wizard_page.form_errors_label.text())
115 self.assertTrue(expected.endswith(u'\u2026'))
116
117 def test_hide_error(self):
118 """Test show_error with a long length string."""
119 message = ' '
120 self.sso_wizard_page.hide_error()
121 self.assertEqual(
122 self.sso_wizard_page.form_errors_label.text(), message)
84123
=== modified file 'ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py'
--- ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py 2012-02-29 17:33:56 +0000
+++ ubuntu_sso/qt/tests/test_ubuntu_sso_wizard.py 2012-03-01 20:49:18 +0000
@@ -105,8 +105,10 @@
105 self.ui.show()105 self.ui.show()
106 self.addCleanup(self.ui.hide)106 self.addCleanup(self.ui.hide)
107 size = self.ui.size()107 size = self.ui.size()
108 self.assertTrue(size.height() >= PREFERED_UI_SIZE['height'])108 # pylint: disable=E1101
109 self.assertEqual(size.width(), PREFERED_UI_SIZE['width'])109 self.assertGreaterEqual(size.height(), PREFERED_UI_SIZE['height'])
110 self.assertGreaterEqual(size.width(), PREFERED_UI_SIZE['width'])
111 # pylint: enable=E1101
110112
111 def test_move_to_success_page_state(self):113 def test_move_to_success_page_state(self):
112 """Test _move_to_success_page method."""114 """Test _move_to_success_page method."""

Subscribers

People subscribed via source and target branches