ensure we clear session cookies

This commit is contained in:
dandds 2018-07-12 16:43:41 -04:00
parent 5b4a8fd2d3
commit 335bbed94d
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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)