~mvo/ubuntu-sso-client/strawman-lp711413

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/tests/test_windows.py

Added the way to reset the password.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    CurrentUserController,
25
25
    EmailVerificationController,
26
26
    ErrorController,
 
27
    FAKE_URL,
27
28
    SetUpAccountController,
28
29
    SuccessController,
29
30
    TosController,
52
53
    VERIFY_EMAIL_TITLE,
53
54
    VERIFY_EMAIL_CONTENT,
54
55
    YES_TO_TC,
55
 
    is_min_required_password)
 
56
    is_min_required_password,
 
57
    is_correct_email)
56
58
 
57
59
#ignore the comon mocker issues with lint
58
60
# pylint: disable=W0212,W0104
120
122
        """test that the ui is correctly set up."""
121
123
        self.view.email_edit.setPlaceholderText(EMAIL1_ENTRY)
122
124
        self.view.password_edit.setPlaceholderText(PASSWORD1_ENTRY)
123
 
        self.view.forgot_password_label.setText(FORGOTTEN_PASSWORD_BUTTON)
 
125
        self.view.forgot_password_label.setText(
 
126
                                        FAKE_URL % FORGOTTEN_PASSWORD_BUTTON)
124
127
        self.view.sign_in_button.setText(SIGN_IN_BUTTON)
125
128
        self.mocker.replay()
126
129
        self.controller._set_translated_strings(self.view)
130
133
        self.view.sign_in_button.clicked.connect(MATCH(callable))
131
134
        self.backend.on_login_error_cb = MATCH(callable)
132
135
        self.backend.on_logged_in_cb = MATCH(callable)
 
136
        self.view.forgot_password_label.linkActivated.connect(MATCH(callable))
133
137
        self.mocker.replay()
134
 
        self.controller._connect_buttons(self.view, self.backend)
 
138
        self.controller._connect_ui(self.view, self.backend)
135
139
 
136
140
 
137
141
class SetUpAccountControllerTestCase(MockerTestCase):
146
150
        self.app_name = 'test'
147
151
        self.help = 'help'
148
152
        self.message_box = self.mocker.mock()
149
 
        self.controller = SetUpAccountController(app_name=self.app_name,
150
 
                                                 help_message=self.help,
151
 
                                                 message_box=self.message_box)
 
153
        self.controller = SetUpAccountController(message_box=self.message_box)
152
154
 
153
155
    def test_set_translated_strings(self):
154
156
        """Ensure all the strings are set."""
234
236
                self.controller.is_correct_email_confirmation(email_address,
235
237
                                                              self.view))
236
238
 
237
 
    def test_is_correct_email_true(self):
238
 
        """Test when the email is correct."""
239
 
        email = 'manuel@canonical.com'
240
 
        self.mocker.replay()
241
 
        self.assertTrue(self.controller.is_correct_email(email))
242
 
 
243
 
    def test_is_correct_email_false(self):
244
 
        """Test when the email is not correct."""
245
 
        email = 'manuelcanonical.com'
246
 
        self.mocker.replay()
247
 
        self.assertFalse(self.controller.is_correct_email(email))
248
 
 
249
239
    def test_set_next_tos(self):
250
240
        """Test the callback."""
251
241
        next_id = 2
263
253
        password = 'Qwerty9923'
264
254
        captcha_id = 'captcha_id'
265
255
        captcha_solution = 'captcha_solution'
 
256
        self.view.wizard().app_name
 
257
        self.mocker.result(self.app_name)
266
258
        self.view.email
267
259
        self.mocker.result(email)
268
260
        self.view.email_edit.text()
356
348
        """Set the validations to be performed on the edits."""
357
349
        self.view.email_edit
358
350
        self.mocker.result(self.view)
359
 
        self.view.set_line_edit_validation_rule(self.view,
360
 
                                            self.controller.is_correct_email)
 
351
        self.view.set_line_edit_validation_rule(self.view, is_correct_email)
361
352
        self.view.confirm_email_edit
362
353
        self.mocker.result(self.view)
363
354
        self.view.set_line_edit_validation_rule(self.view, MATCH(callable))
481
472
        """Set tests."""
482
473
        super(UbuntuSSOWizardControllerTestCase, self).setUp()
483
474
        self.app_name = 'test'
484
 
        self.controller = UbuntuSSOWizardController(app_name=self.app_name)
 
475
        self.controller = UbuntuSSOWizardController()
485
476
        self.callback = self.mocker.mock()
486
477
        self.view = self.mocker.mock()
487
478