Exemple #1
0
    def test_log_out_removes_token(self):
        stub_request = mock.Mock()

        cookie = auth.log_in_as_user(stub_request, 'user')
        num_tokens = len(auth.login_tokens)
        auth.forget_login_cookie(cookie)

        assert len(auth.login_tokens) == num_tokens - 1
Exemple #2
0
 def token_login(self, cookie):
     username, ok = auth.check_login_cookie(cookie)
     if ok:
         auth.forget_login_cookie(cookie)
         self.logger.info("User %s logging in (via token).", username)
         self.do_login(username)
     else:
         self.logger.warning("Wrong login token for user %s.", username)
         self.send_message("login_fail")
Exemple #3
0
    def test_repeated_log_out_is_idempotent(self):
        stub_request = mock.Mock()

        cookie = auth.log_in_as_user(stub_request, 'user')
        auth.forget_login_cookie(cookie)
        login_tokens = auth.login_tokens
        auth.forget_login_cookie(cookie)  # Repeat call should do nothing

        assert login_tokens == auth.login_tokens
Exemple #4
0
 def forget_login_cookie(self, cookie):
     auth.forget_login_cookie(cookie)