From fbb4345116758af03358f9e5f90b1d295f8bc24e Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 3 Jul 2026 16:18:24 +0000 Subject: [PATCH] =?UTF-8?q?Abri=20amend=5Fjob=20serialises=20the=20spec's?= =?UTF-8?q?=20amendoptiappt=20envelope=20with=20the=20surveyor=20resource?= =?UTF-8?q?=20last=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 --- ...ri_relay_amendoptiappt_request_example.xml | 15 ++++++++++ tests/infrastructure/abri/test_abri_client.py | 28 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 tests/abri/abri_relay_amendoptiappt_request_example.xml diff --git a/tests/abri/abri_relay_amendoptiappt_request_example.xml b/tests/abri/abri_relay_amendoptiappt_request_example.xml new file mode 100644 index 000000000..10c9b8941 --- /dev/null +++ b/tests/abri/abri_relay_amendoptiappt_request_example.xml @@ -0,0 +1,15 @@ + + +
+ +
+ + + + + + + + + +
diff --git a/tests/infrastructure/abri/test_abri_client.py b/tests/infrastructure/abri/test_abri_client.py index 7c205ab7d..87e13b9d1 100644 --- a/tests/infrastructure/abri/test_abri_client.py +++ b/tests/infrastructure/abri/test_abri_client.py @@ -224,3 +224,31 @@ def test_amend_job_returns_appointment_amended_echoing_the_response_attributes( appointment_date="24/06/2026", appointment_time="PM", ) + + +def test_amend_job_sends_the_recorded_amendoptiappt_envelope_to_the_relay_endpoint( + client: AbriClient, mock_session: MagicMock +) -> None: + # Arrange + mock_session.post.return_value.content = _load_fixture( + "abri_relay_amendoptiappt_success_response.xml" + ) + + # Act + client.amend_job( + AmendJobRequest( + job_no="AC0439951", + appointment_date=date(2026, 6, 19), + appointment_time="PM", + resource="NAULKH", + ) + ) + + # Assert + (url,) = mock_session.post.call_args.args + sent_body: bytes = mock_session.post.call_args.kwargs["data"] + expected_body = _load_fixture("abri_relay_amendoptiappt_request_example.xml") + assert url == ENDPOINT_URL + assert ET.canonicalize(xml_data=sent_body, strip_text=True) == ET.canonicalize( + xml_data=expected_body, strip_text=True + )