aboutsummaryrefslogtreecommitdiff
path: root/tests/tasks/test_sender.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/tasks/test_sender.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/tasks/test_sender.py12
1 files changed, 12 insertions, 0 deletions
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