From eb11fb64e9cad6fbda2065362189653416d98577 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 19 Nov 2026 21:18:37 +0100 Subject: 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. --- tests/tasks/test_sender.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/tasks/test_sender.py') diff --git a/tests/tasks/test_sender.py b/tests/tasks/test_sender.py index 5be2177..4954d04 100644 --- a/tests/tasks/test_sender.py +++ b/tests/tasks/test_sender.py @@ -739,3 +739,15 @@ def test_send_does_not_persist_unsafe_status_url( assert mention.status == SentWebmentionStatus.SENT assert mention.endpoint_response_status == HTTPStatus.CREATED assert mention.status_url == expected + + +def test_reserve_send_attempt_rejects_lost_claim( + app: Flask, sender_module: ModuleType, monkeypatch: pytest.MonkeyPatch +) -> None: + identifier = create_sent_webmention(app) + monkeypatch.setattr(sender_module, "rows_affected", lambda result: 0) + + with app.app_context(): + webmention = db.session.get(SentWebmention, identifier) + assert webmention is not None + assert sender_module.reserve_send_attempt(webmention, datetime.now(UTC)) is None -- cgit v1.3.1