diff --git a/tests/orchestration/test_tenant_data_sync_orchestrator.py b/tests/orchestration/test_tenant_data_sync_orchestrator.py index 3ed1272aa..329f04a90 100644 --- a/tests/orchestration/test_tenant_data_sync_orchestrator.py +++ b/tests/orchestration/test_tenant_data_sync_orchestrator.py @@ -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( + '1368473' + "07000000099" # no priority: sorts last + ' ' # blank number: ignored + '07000000020' + '07000000005' # lowest priority: wins + '01000000001' # unusable: sorts last + '01000000007' # tie, first in document + '01000000008' + "" + ) + + # 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,