aboutsummaryrefslogtreecommitdiff
path: root/tests/test_auth.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_auth.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index bc951b9..3b05b6f 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -4,6 +4,8 @@
"""Test the session user loader."""
+from http import HTTPStatus
+
import pytest
from flask import Flask
@@ -94,8 +96,8 @@ def test_password_change_invalidates_existing_session(app: Flask) -> None:
response = client.post(
"/login", data={"username": "account", "password": old_password}
)
- assert response.status_code == 302
- assert client.get("/received").status_code == 200
+ assert response.status_code == HTTPStatus.FOUND
+ assert client.get("/received").status_code == HTTPStatus.OK
with client.session_transaction() as session:
assert session["_user_id"] == old_identifier
@@ -113,14 +115,14 @@ def test_password_change_invalidates_existing_session(app: Flask) -> None:
assert load_user(user.get_id()) is user
# A pre-existing, validly signed cookie no longer authenticates.
- assert client.get("/received").status_code == 302
+ assert client.get("/received").status_code == HTTPStatus.FOUND
# Logging in with the newly chosen password still works.
response = client.post(
"/login", data={"username": "account", "password": new_password}
)
- assert response.status_code == 302
- assert client.get("/received").status_code == 200
+ assert response.status_code == HTTPStatus.FOUND
+ assert client.get("/received").status_code == HTTPStatus.OK
@pytest.mark.parametrize(