From 05bd22269da29750ee59b57e3ff46ed1257d500e Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 3 Jul 2026 16:23:53 +0000 Subject: [PATCH] =?UTF-8?q?Abri=20amend=5Fjob=20raises=20retriable=20trans?= =?UTF-8?q?port=20errors=20when=20the=20amendment=20outcome=20is=20unknown?= =?UTF-8?q?=20=F0=9F=9F=A9?= 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 | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/infrastructure/abri/test_abri_client.py b/tests/infrastructure/abri/test_abri_client.py index 55aa5deb5..6ab6c7698 100644 --- a/tests/infrastructure/abri/test_abri_client.py +++ b/tests/infrastructure/abri/test_abri_client.py @@ -320,3 +320,31 @@ def test_amend_job_raises_retriable_parse_error_when_the_amendment_is_unconfirme # Act / Assert with pytest.raises(AbriResponseParseError): client.amend_job(_spec_example_amend_request()) + + +# --- amend_job: transport failures --- + + +def test_amend_job_raises_transport_error_on_http_error_status( + client: AbriClient, mock_session: MagicMock +) -> None: + # Arrange + mock_session.post.return_value.content = b"Server Error" + mock_session.post.return_value.raise_for_status.side_effect = requests.HTTPError( + "500 Server Error" + ) + + # Act / Assert + with pytest.raises(AbriTransportError): + client.amend_job(_spec_example_amend_request()) + + +def test_amend_job_raises_transport_error_when_the_relay_is_unreachable( + client: AbriClient, mock_session: MagicMock +) -> None: + # Arrange + mock_session.post.side_effect = requests.ConnectionError("connection refused") + + # Act / Assert + with pytest.raises(AbriTransportError): + client.amend_job(_spec_example_amend_request())