diff options
| author | Dennis Fink | 2026-11-13 22:12:02 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-13 22:12:02 +0100 |
| commit | 2366d455c7d1ae16c84e0bcbffb94ed762c16832 (patch) | |
| tree | 51de07737ebc12fdcbf29a0a405ff2cd5aa9eb87 /tests/tasks/test_receiver.py | |
| parent | 64f328d86bba9caa9d0a60aa89e06f70403942b9 (diff) | |
| download | webmentions-ssg-2366d455c7d1ae16c84e0bcbffb94ed762c16832.tar.gz webmentions-ssg-2366d455c7d1ae16c84e0bcbffb94ed762c16832.zip | |
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.
Diffstat (limited to '')
| -rw-r--r-- | tests/tasks/test_receiver.py | 19 |
1 files changed, 19 insertions, 0 deletions
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 |
