From ff34872c245d74a007c6f485cffc7a4b33d27be7 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 3 Jul 2026 14:29:08 +0000 Subject: [PATCH] =?UTF-8?q?Abri=20log=5Fjob=20treats=20a=20malformed=20rel?= =?UTF-8?q?ay=20response=20as=20retriable,=20never=20as=20success=20or=20r?= =?UTF-8?q?ejection=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- tests/infrastructure/abri/test_abri_client.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/infrastructure/abri/test_abri_client.py b/tests/infrastructure/abri/test_abri_client.py index 54146c825..2b232455c 100644 --- a/tests/infrastructure/abri/test_abri_client.py +++ b/tests/infrastructure/abri/test_abri_client.py @@ -14,7 +14,7 @@ from domain.abri.models import ( ) from infrastructure.abri.abri_client import AbriClient from infrastructure.abri.config import AbriConfig -from infrastructure.abri.errors import AbriTransportError +from infrastructure.abri.errors import AbriResponseParseError, AbriTransportError FIXTURE_DIR = Path(__file__).parents[2] / "abri" ENDPOINT_URL = "https://relay.example.test/api/DomnaRelay?code=test-function-key" @@ -158,3 +158,17 @@ def test_log_job_raises_transport_error_when_the_relay_is_unreachable( # Act / Assert with pytest.raises(AbriTransportError): client.log_job(_spec_example_request()) + + +# --- log_job: ambiguous responses are retriable, never success or rejection --- + + +def test_log_job_raises_retriable_parse_error_on_a_malformed_response_body( + client: AbriClient, mock_session: MagicMock +) -> None: + # Arrange + mock_session.post.return_value.content = b"not xml at all <<<" + + # Act / Assert + with pytest.raises(AbriResponseParseError): + client.log_job(_spec_example_request())