mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Abri log_job surfaces an OpenHousing rejection as a typed result with verbatim code and message 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
79ce9dc4b1
commit
e473ea8a4f
1 changed files with 30 additions and 1 deletions
|
|
@ -5,7 +5,12 @@ from unittest.mock import MagicMock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from domain.abri.models import JobLogged, LogJobRequest, PlaceRef
|
||||
from domain.abri.models import (
|
||||
AbriRequestRejected,
|
||||
JobLogged,
|
||||
LogJobRequest,
|
||||
PlaceRef,
|
||||
)
|
||||
from infrastructure.abri.abri_client import AbriClient
|
||||
from infrastructure.abri.config import AbriConfig
|
||||
|
||||
|
|
@ -99,3 +104,27 @@ def test_log_job_sends_the_recorded_logjob_envelope_to_the_relay_endpoint(
|
|||
assert ET.canonicalize(xml_data=sent_body, strip_text=True) == ET.canonicalize(
|
||||
xml_data=expected_body, strip_text=True
|
||||
)
|
||||
|
||||
|
||||
# --- log_job: rejection ---
|
||||
|
||||
|
||||
def test_log_job_returns_rejection_with_openhousing_error_code_and_message_verbatim(
|
||||
client: AbriClient, mock_session: MagicMock
|
||||
) -> None:
|
||||
# Arrange
|
||||
mock_session.post.return_value.content = _load_fixture(
|
||||
"abri_relay_logjob_relayerror_response.xml"
|
||||
)
|
||||
|
||||
# Act
|
||||
result = client.log_job(_spec_example_request())
|
||||
|
||||
# Assert
|
||||
assert result == AbriRequestRejected(
|
||||
code="RelayError",
|
||||
message=(
|
||||
"No property was found with UPRN/place_ref '1007176aa', "
|
||||
"street name '', house number '0', house name '', post code ''"
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue