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())