An OpenHousing rejection is surfaced verbatim with nothing recorded 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-06 15:54:58 +00:00
parent 96f86aacac
commit ddfbbd0052

View file

@ -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 == []