Contact carries the best-priority mobile and landline Abri lists 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-06 13:27:39 +00:00
parent 01e61a6275
commit 1d3219ca60

View file

@ -187,6 +187,38 @@ def test_run_creates_a_separate_contact_for_each_signatory(
assert associated_contact_ids == ["60123", "60124"]
def test_run_picks_the_best_priority_number_of_each_kind_for_a_contact(
orchestrator: TenantDataSyncOrchestrator,
mock_session: MagicMock,
sdk_client: MagicMock,
) -> None:
# Arrange
mock_session.post.return_value.content = _tenancy_response(
'<Tenant forenames="Amanjeet" main-contact="yes" person_title="Mrs"'
' surname="Okello">1368473'
"<Mobile>07000000099</Mobile>" # no priority: sorts last
'<Mobile priority="1"> </Mobile>' # blank number: ignored
'<Mobile priority="20">07000000020</Mobile>'
'<Mobile priority="5">07000000005</Mobile>' # lowest priority: wins
'<Telephone priority="abc">01000000001</Telephone>' # unusable: sorts last
'<Telephone priority="7">01000000007</Telephone>' # tie, first in document
'<Telephone priority="7">01000000008</Telephone>'
"</Tenant>"
)
# Act
orchestrator.run(PLACE_REF, deal_id=DEAL_ID)
# Assert
created_properties = (
sdk_client.crm.contacts.basic_api.create.call_args.kwargs[
"simple_public_object_input_for_create"
].properties
)
assert created_properties["mobilephone"] == "07000000005"
assert created_properties["phone"] == "01000000007"
def test_run_still_creates_a_contact_for_an_all_blank_signatory(
orchestrator: TenantDataSyncOrchestrator,
mock_session: MagicMock,