atst/tests/routes/test_errors.py
2018-10-16 21:30:35 -04:00

14 lines
398 B
Python

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