Abri amend_job treats an unconfirmed amendment response as retriable 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-03 16:22:49 +00:00
parent e9cb46a58b
commit 65ec38012b

View file

@ -293,3 +293,30 @@ def test_amend_job_returns_rejection_with_openhousing_error_code_and_message_ver
code="RelayError",
message="Job_no 1019905 is invalid. Job not found.",
)
# --- amend_job: ambiguous responses are retriable, never success or rejection ---
@pytest.mark.parametrize(
"body",
[
b'<Root><AmendOptiAppt appointment_date="24/06/2026"'
b' appointment_time="PM" job_no="AC0439951" success="N" /></Root>',
b'<Root><AmendOptiAppt appointment_date="24/06/2026"'
b' appointment_time="PM" job_no="AC0439951" /></Root>',
b'<Root><AmendOptiAppt appointment_date="24/06/2026"'
b' appointment_time="PM" success="Y" /></Root>',
b"<Root></Root>",
b"<unexpected />",
],
)
def test_amend_job_raises_retriable_parse_error_when_the_amendment_is_unconfirmed(
client: AbriClient, mock_session: MagicMock, body: bytes
) -> None:
# Arrange
mock_session.post.return_value.content = body
# Act / Assert
with pytest.raises(AbriResponseParseError):
client.amend_job(_spec_example_amend_request())