aboutsummaryrefslogtreecommitdiff
path: root/tests/test_auth.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-19 21:18:37 +0100
committerDennis Fink2026-11-19 21:18:37 +0100
commiteb11fb64e9cad6fbda2065362189653416d98577 (patch)
tree0bc5737b1c273ea6f04adc015154565c385dc719 /tests/test_auth.py
parent88f54d9a7699944b7d56f978e724b1c0b54dde98 (diff)
downloadwebmentions-ssg-eb11fb64e9cad6fbda2065362189653416d98577.tar.gz
webmentions-ssg-eb11fb64e9cad6fbda2065362189653416d98577.zip
test: expand failure and migration coverage
Add regression coverage for malformed input, lost task claims, moderation races, network failures, serializer validation, and production configuration guards. Exercise migration downgrade, backfill, and autogeneration paths plus additional receiver and sender edge cases.
Diffstat (limited to '')
-rw-r--r--tests/test_auth.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 27e8fb0..2a3d517 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -161,3 +161,13 @@ def test_password_change_invalidates_existing_session(app: Flask) -> None:
)
def test_is_safe_next_url(next_url: str, expected: bool) -> None:
assert is_safe_next_url(next_url) is expected
+
+
+def test_safe_next_url_fails_closed_when_url_parser_rejects_path(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ def invalid_url(_: str) -> object:
+ raise ValueError("Malformed URL")
+
+ monkeypatch.setattr(auth, "urlsplit", invalid_url)
+ assert is_safe_next_url("/local/path") is False