def test_success_with_no_user(self, fetch_command_cls, write_cookie):
        app, fetch_cmd_obj, response = self.setup_base_mock(fetch_command_cls)
        main_user = facade.login_passwordless('0123', response,
                                              'https://pswdless.appspot.com/rest/detail').execute().result
        self.assertIsNotNone(main_user)

        self.assertEqual('*****@*****.**', main_user.email)
        self.assertEqual('*****@*****.**', main_user.name)
        self.assert_base_execution(app, fetch_cmd_obj, fetch_command_cls, main_user, PasswordlessUser.query().get(),
                                   write_cookie, response)
    def test_success_with_main_user(self, fetch_command_cls, write_cookie):
        app, fetch_cmd_obj, response = self.setup_base_mock(fetch_command_cls)

        main_user_on_db = mommy.save_one(MainUser, email="*****@*****.**")

        main_user = facade.login_passwordless('0123', response,
                                              'https://pswdless.appspot.com/rest/detail').execute().result

        self.assertEqual(main_user_on_db, main_user)

        p_user = PasswordlessUser.query().get()
        self.assertIsNotNone(p_user)
        self.assert_base_execution(app, fetch_cmd_obj, fetch_command_cls, main_user, p_user, write_cookie, response)
    def test_success_with_passwordless_user(self, fetch_command_cls, write_cookie):
        app, fetch_cmd_obj, response = self.setup_base_mock(fetch_command_cls)

        main_user_on_db = mommy.save_one(MainUser, email="*****@*****.**")
        p_user_on_db = mommy.save_one(PasswordlessUser, external_id="654321")
        ExternalToMainUser(origin=p_user_on_db.key, destination=main_user_on_db.key).put()

        main_user = facade.login_passwordless('0123',
                                              response,
                                              'https://pswdless.appspot.com/rest/detail').execute().result

        self.assertEqual(main_user_on_db, main_user)

        p_user = PasswordlessUser.query().get()
        self.assertEqual(p_user_on_db, p_user)
        self.assert_base_execution(app, fetch_cmd_obj, fetch_command_cls, main_user, p_user, write_cookie, response)
Beispiel #4
0
def check( _resp, ticket, ret_path='/'):
    facade.login_passwordless(ticket, _resp).execute()
    return RedirectResponse(ret_path)
Beispiel #5
0
def checar(_handler, _resp, ticket, ret_path='/'):
    facade.login_passwordless(ticket, _resp).execute()
    _handler.redirect(ret_path)
def check(_resp, ticket, ret_path='/'):
    facade.login_passwordless(ticket, _resp).execute()
    return RedirectResponse(ret_path)