From ddfbbd0052f26b2851aeaf936858ffb4c9ef2710 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 15:54:58 +0000 Subject: [PATCH] =?UTF-8?q?An=20OpenHousing=20rejection=20is=20surfaced=20?= =?UTF-8?q?verbatim=20with=20nothing=20recorded=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 --- .../test_abri_log_job_orchestrator.py | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/orchestration/test_abri_log_job_orchestrator.py b/tests/orchestration/test_abri_log_job_orchestrator.py index 2cfb265f8..6bab8181a 100644 --- a/tests/orchestration/test_abri_log_job_orchestrator.py +++ b/tests/orchestration/test_abri_log_job_orchestrator.py @@ -7,7 +7,7 @@ from unittest.mock import MagicMock, patch import pytest from hubspot.crm.deals import SimplePublicObjectInput # type: ignore[reportMissingTypeStubs] -from domain.abri.models import PlaceRef +from domain.abri.models import AbriRequestRejected, PlaceRef from infrastructure.abri.abri_client import AbriClient from infrastructure.abri.config import AbriConfig from infrastructure.hubspot.deal_properties_client import HubspotDealPropertiesClient @@ -149,3 +149,28 @@ def test_run_writes_the_job_no_to_the_hubspot_deal_and_then_the_database( ), ) assert deal_database.recorded_job_nos == [(DEAL_ID, "AD0226519")] + + +# --- rejection passthrough: OpenHousing's actual reason, nothing recorded --- + + +def test_run_returns_the_openhousing_rejection_verbatim_and_records_nothing( + orchestrator: AbriLogJobOrchestrator, + mock_session: MagicMock, + sdk_client: MagicMock, + deal_database: FakeDealDatabase, +) -> None: + # Arrange + mock_session.post.return_value.content = _load_fixture( + "abri_relay_logjob_relayerror_response.xml" + ) + + # Act + result = orchestrator.run(BOOKING) + + # Assert + assert isinstance(result, AbriRequestRejected) + assert result.code == "RelayError" + assert result.message.startswith("No property was found with UPRN/place_ref") + assert sdk_client.mock_calls == [] + assert deal_database.recorded_job_nos == []