From 2366d455c7d1ae16c84e0bcbffb94ed762c16832 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 13 Nov 2026 22:12:02 +0100 Subject: refactor(core): split task workflows into focused helpers Decompose receiver verification, source scanning, and Webmention delivery into explicit claim, check, reconciliation, and outcome-recording stages. Extract Huey backend parsing helpers and add focused tests for the new task boundaries while preserving existing processing semantics. --- tests/tasks/test_receiver.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/tasks/test_receiver.py') diff --git a/tests/tasks/test_receiver.py b/tests/tasks/test_receiver.py index 44e8c58..b817162 100644 --- a/tests/tasks/test_receiver.py +++ b/tests/tasks/test_receiver.py @@ -321,6 +321,25 @@ def test_source_mentions_target_rejects_unsupported_media_type( receiver.source_mentions_target(SOURCE_URL, TARGET_URL) +@pytest.mark.parametrize( + ("mentions", "expected_status", "expected_reason"), + [(True, "verified", None), (False, "deleted", "Source does not mention target")], +) +def test_check_source_returns_outcome( + receiver: ModuleType, + monkeypatch: pytest.MonkeyPatch, + mentions: bool, + expected_status: str, + expected_reason: str | None, +) -> None: + monkeypatch.setattr(receiver, "source_mentions_target", Mock(return_value=mentions)) + claim = receiver.VerificationClaim( + uuid.uuid7(), SOURCE_URL, TARGET_URL, datetime.now(UTC) + ) + + assert receiver.check_source(claim) == (expected_status, expected_reason) + + @patch("webmentions_ssg.tasks.receiver.source_mentions_target") def test_verify_webmention_marks_row_verifying_before_check( source_mentions_target: Mock, app: Flask, receiver: ModuleType -- cgit v1.3.1