diff --git a/atst/handler.py b/atst/handler.py index 2ad1acaf..ac6dc4b4 100644 --- a/atst/handler.py +++ b/atst/handler.py @@ -23,6 +23,7 @@ class BaseHandler(tornado.web.RequestHandler): try: session = self.application.sessions.get_session(cookie) except SessionNotFoundError: + self.clear_cookie("atat") return None else: return None diff --git a/tests/test_auth.py b/tests/test_auth.py index b5c420e2..a74b92d5 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -26,6 +26,9 @@ def test_redirects_when_session_does_not_exist(monkeypatch, http_client, base_ur base_url + "/home", raise_error=False, follow_redirects=False ) location = response.headers["Location"] + cookie = response.headers._dict.get('Set-Cookie') + # should clear session cookie + assert 'atat=""' in cookie assert response.code == 302 assert response.error assert re.match("/\??", location)