diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/tasks/test_sender.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tasks/test_sender.py b/tests/tasks/test_sender.py index 94523e5..818092b 100644 --- a/tests/tasks/test_sender.py +++ b/tests/tasks/test_sender.py @@ -431,6 +431,29 @@ def test_sender_malformed_request_is_terminal( assert post.call_count == (1 if stage == "post" else 0) +def test_sender_logs_unexpected_value_error_traceback( + app: Flask, + sender_module: ModuleType, + monkeypatch: pytest.MonkeyPatch, + caplog: pytest.LogCaptureFixture, +) -> None: + identifier = create_sent_webmention(app) + _, _, discover, _ = mock_sender_requests(sender_module, monkeypatch) + discover.side_effect = ValueError("unexpected parsing bug") + + with caplog.at_level(logging.ERROR): + sender_module.send_webmention.call_local(identifier) + + assert f"Unexpected error sending SentWebmention {identifier}" in caplog.text + assert "ValueError: unexpected parsing bug" in caplog.text + with app.app_context(): + webmention = db.session.get(SentWebmention, identifier) + assert webmention is not None + assert webmention.status == SentWebmentionStatus.FAILED + assert webmention.failure_reason == "unexpected parsing bug" + assert webmention.processed_revision == 1 + + @pytest.mark.parametrize( ("target", "reason"), [ |
