diff --git a/tests/infrastructure/abri/test_abri_client.py b/tests/infrastructure/abri/test_abri_client.py index 87e13b9d1..ed6b4cecf 100644 --- a/tests/infrastructure/abri/test_abri_client.py +++ b/tests/infrastructure/abri/test_abri_client.py @@ -252,3 +252,23 @@ def test_amend_job_sends_the_recorded_amendoptiappt_envelope_to_the_relay_endpoi assert ET.canonicalize(xml_data=sent_body, strip_text=True) == ET.canonicalize( xml_data=expected_body, strip_text=True ) + + +def test_amend_job_omits_the_resource_parameter_when_no_surveyor_is_provided( + 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(_spec_example_amend_request()) + + # Assert + sent_body: bytes = mock_session.post.call_args.kwargs["data"] + sent_attributes = [ + parameter.get("attribute") + for parameter in ET.fromstring(sent_body).findall(".//Parameters") + ] + assert "resource" not in sent_attributes