aboutsummaryrefslogtreecommitdiff
path: root/tests/tasks/test_receiver.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tasks/test_receiver.py')
-rw-r--r--tests/tasks/test_receiver.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/tasks/test_receiver.py b/tests/tasks/test_receiver.py
index 133ab56..51d1bb6 100644
--- a/tests/tasks/test_receiver.py
+++ b/tests/tasks/test_receiver.py
@@ -198,6 +198,25 @@ def test_fetch_source_rejects_streamed_oversized_body(
receiver.fetch_source(SOURCE_URL)
+@patch("webmentions_ssg.tasks.receiver.httpx.Client")
+def test_fetch_source_does_not_mask_unexpected_value_error(
+ httpx_client: Mock,
+ app: Flask,
+ receiver: ModuleType,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ set_stream_response(
+ httpx_client,
+ httpx.Response(200, request=httpx.Request("GET", SOURCE_URL)),
+ )
+ monkeypatch.setattr(
+ receiver, "read_limited_body", Mock(side_effect=ValueError("unexpected bug"))
+ )
+
+ with app.app_context(), pytest.raises(ValueError, match="unexpected bug"):
+ receiver.fetch_source(SOURCE_URL)
+
+
@patch("webmentions_ssg.tasks.receiver.fetch_source")
@pytest.mark.parametrize(
("content_type", "body", "expected"),