~verterok/ubuntu-sso-client/fix-910163

« back to all changes in this revision

Viewing changes to ubuntu_sso/main/tests/test_linux.py

Fixed: When logging in with an no-yet-validated account, there is no useful message (LP: #851885).

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
        client.login(APP_NAME, EMAIL, PASSWORD)
239
239
        return d
240
240
 
241
 
    def test_login_user_not_validated(self):
242
 
        """Test that the login sends EmailNotValidated signal."""
243
 
        d = defer.Deferred()
244
 
        processor = self.create_mock_processor()
245
 
        processor.login(EMAIL, PASSWORD, TOKEN_NAME)
246
 
        self.mocker.result(TOKEN)
247
 
        processor.is_validated(TOKEN)
248
 
        self.mocker.result(False)
249
 
        self.patch(ubuntu_sso.main.linux, "blocking", fake_ok_blocking)
250
 
        self.mocker.replay()
251
 
 
252
 
        def verify(app_name, email):
253
 
            """The actual test."""
254
 
            self.assertEqual(app_name, APP_NAME)
255
 
            self.assertEqual(email, EMAIL)
256
 
            self.assertFalse(self.keyring_was_set, "Keyring should not be set")
257
 
            d.callback("Ok")
258
 
 
259
 
        client = SSOLogin(self.mockbusname,
260
 
                          sso_login_processor_class=self.mockprocessorclass)
261
 
        self.patch(client, "LoggedIn", d.errback)
262
 
        self.patch(client, "LoginError", d.errback)
263
 
        self.patch(client, "UserNotValidated", verify)
264
 
        client.login(APP_NAME, EMAIL, PASSWORD)
265
 
        return d
266
 
 
267
241
    def test_login_error_get_token_name(self):
268
242
        """The login method fails as expected when get_token_name fails."""
269
243
        d = defer.Deferred()