add Flask error handlers

This commit is contained in:
dandds
2018-08-08 11:26:54 -04:00
parent 2cfc142417
commit 7b8934e0cb
7 changed files with 34 additions and 18 deletions

View File

@@ -49,7 +49,7 @@ def test_non_owner_cannot_view_request(client, user_session):
response = client.get("/requests/new/1/{}".format(request.id), follow_redirects=True)
assert response.status_code == 401
assert response.status_code == 404
def test_ccpo_can_view_request(client, user_session):

View File

@@ -27,8 +27,7 @@ def test_successful_login_redirect(client, monkeypatch):
def test_unsuccessful_login_redirect(client, monkeypatch):
resp = client.get("/login-redirect")
assert resp.status_code == 302
assert "unauthorized" in resp.headers["Location"]
assert resp.status_code == 401
assert "user_id" not in session
@@ -55,7 +54,6 @@ def test_routes_are_protected(client, app):
UNPROTECTED_ROUTES = ["/", "/login-dev", "/login-redirect", "/unauthorized"]
# this implicitly relies on the test config and test CRL in tests/fixtures/crl
@@ -72,8 +70,7 @@ def test_crl_validation_on_login(client):
"HTTP_X_SSL_CLIENT_CERT": bad_cert.decode(),
},
)
assert resp.status_code == 302
assert "unauthorized" in resp.headers["Location"]
assert resp.status_code == 401
assert "user_id" not in session
# good cert is not on the test CRL, passes