Redirect to login page when CSRF error occurs

This commit is contained in:
Patrick Smith
2018-10-16 17:23:09 -04:00
parent e7b437dc56
commit c7d5015942
3 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
def test_csrf_error(app, client):
app.config.update({"WTF_CSRF_ENABLED": True})
response = client.post(
"/requests/new/1",
headers={ "Content-Type": "application/x-www-form-urlencoded" },
data="csrf_token=invalid_token",
follow_redirects=True,
)
body = response.data.decode()
assert "Session Expired" in body
assert "Log in Required" in body