Abri amend_job serialises the spec's amendoptiappt envelope with the surveyor resource last 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-03 16:18:24 +00:00
parent c542a57ae5
commit fbb4345116
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<message>
<Header>
<Security username="DomnaWeb" password="" />
</Header>
<Body>
<Request request_type="amendoptiappt">
<Parameters attribute="job_no" attribute_value="AC0439951" />
<Parameters attribute="action" attribute_value="amend" />
<Parameters attribute="appointment_date" attribute_value="19/06/2026" />
<Parameters attribute="appointment_time" attribute_value="PM" />
<Parameters attribute="resource" attribute_value="NAULKH" />
</Request>
</Body>
</message>

View file

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