mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Report a void property when Abri finds no tenancy for the place 🟥
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ab7b5e388f
commit
a7ae408ab2
3 changed files with 39 additions and 1 deletions
|
|
@ -108,7 +108,20 @@ class TenancyData:
|
|||
tenants: Tuple[Tenant, ...]
|
||||
|
||||
|
||||
GetTenantDataResult = Union[TenancyData, AbriRequestRejected]
|
||||
@dataclass(frozen=True)
|
||||
class NoTenancyFound:
|
||||
"""Abri reports no live tenancy for the place: the property is void.
|
||||
|
||||
Distinct from a TenancyData carrying no tenants (a tenancy exists, but
|
||||
nobody is recorded against it) and from a rejection (the request itself
|
||||
was refused). Only Abri's exact No_tenancy_found signal means this; the
|
||||
query-dump variant of the same words is a genuine failure.
|
||||
"""
|
||||
|
||||
place_ref: PlaceRef
|
||||
|
||||
|
||||
GetTenantDataResult = Union[TenancyData, NoTenancyFound, AbriRequestRejected]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<response>
|
||||
<success>false</success>
|
||||
<code>RelayError</code>
|
||||
<message>No_tenancy_found</message>
|
||||
</response>
|
||||
|
|
@ -15,6 +15,7 @@ from domain.abri.models import (
|
|||
JobAbandoned,
|
||||
JobLogged,
|
||||
LogJobRequest,
|
||||
NoTenancyFound,
|
||||
PlaceRef,
|
||||
)
|
||||
from infrastructure.abri.abri_client import AbriClient
|
||||
|
|
@ -556,3 +557,21 @@ def test_abandon_job_sends_the_recorded_canceljob_envelope_to_the_relay_endpoint
|
|||
assert ET.canonicalize(xml_data=sent_body, strip_text=True) == ET.canonicalize(
|
||||
xml_data=expected_body, strip_text=True
|
||||
)
|
||||
|
||||
|
||||
# --- get_tenant_data: a void property is not a rejection ---
|
||||
|
||||
|
||||
def test_get_tenant_data_reports_a_void_property_when_abri_finds_no_tenancy(
|
||||
client: AbriClient, mock_session: MagicMock
|
||||
) -> None:
|
||||
# Arrange: Abri's agreed signal that the place is known to be empty.
|
||||
mock_session.post.return_value.content = _load_fixture(
|
||||
"abri_relay_getscstenantdata_notenancyfound_response.xml"
|
||||
)
|
||||
|
||||
# Act
|
||||
result = client.get_tenant_data(PlaceRef("1004202A"))
|
||||
|
||||
# Assert
|
||||
assert result == NoTenancyFound(place_ref=PlaceRef("1004202A"))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue