aboutsummaryrefslogtreecommitdiff
path: root/tests/views/test_endpoint.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/views/test_endpoint.py')
-rw-r--r--tests/views/test_endpoint.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/views/test_endpoint.py b/tests/views/test_endpoint.py
index bf99ed4..63c17c6 100644
--- a/tests/views/test_endpoint.py
+++ b/tests/views/test_endpoint.py
@@ -529,3 +529,19 @@ def test_endpoint_records_initial_and_resubmission_events(
"Received submission",
"Resubmitted after cooldown",
]
+
+
+def test_submission_returns_none_when_competing_insert_cannot_be_found(
+ app: Flask, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ from webmentions_ssg.views import endpoint
+
+ find = Mock(return_value=None)
+ insert = Mock(return_value=None)
+ monkeypatch.setattr(endpoint, "find_received_webmention", find)
+ monkeypatch.setattr(endpoint, "try_insert_received_webmention", insert)
+
+ with app.app_context():
+ assert endpoint.record_submission(SOURCE_URL, TARGET_URL) is None
+ assert find.call_count == 2
+ insert.assert_called_once_with(SOURCE_URL, TARGET_URL)