Relay receives the spec's recorded getSCSTenantData envelope 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-06 13:26:07 +00:00
parent 76d0b4bac9
commit 0ef1687bd7
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<message>
<Header>
<Security username="DomnaWeb" password="" />
</Header>
<Body>
<Request request_type="getSCSTenantData">
<Parameters attribute="place_ref" attribute_value="1004202A" />
</Request>
</Body>
</message>

View file

@ -1,3 +1,5 @@
import xml.etree.ElementTree as ET
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
@ -13,6 +15,7 @@ from orchestration.tenant_data_sync_orchestrator import (
TenantDataSyncSummary,
)
FIXTURE_DIR = Path(__file__).parents[1] / "abri"
ENDPOINT_URL = "https://relay.example.test/api/DomnaRelay?code=test-function-key"
PLACE_REF = PlaceRef("1004202A")
DEAL_ID = "9876543210"
@ -25,6 +28,10 @@ CONFIG = AbriConfig(
)
def _load_fixture(name: str) -> bytes:
return (FIXTURE_DIR / name).read_bytes()
def _tenancy_response(
tenants_xml: str, tenancy_reference: str = "10042020051017"
) -> bytes:
@ -61,6 +68,28 @@ def orchestrator(
)
# --- outbound request: the spec's recorded envelope ---
def test_run_sends_the_recorded_getscstenantdata_envelope_to_the_relay_endpoint(
orchestrator: TenantDataSyncOrchestrator, mock_session: MagicMock
) -> None:
# Arrange
mock_session.post.return_value.content = _tenancy_response("")
# Act
orchestrator.run(PLACE_REF, deal_id=DEAL_ID)
# Assert
(url,) = mock_session.post.call_args.args
sent_body: bytes = mock_session.post.call_args.kwargs["data"]
expected_body = _load_fixture("abri_relay_getscstenantdata_request_example.xml")
assert url == ENDPOINT_URL
assert ET.canonicalize(xml_data=sent_body, strip_text=True) == ET.canonicalize(
xml_data=expected_body, strip_text=True
)
# --- happy path: signatories become associated deal contacts ---