From d4bdbf2e2f48ba99e51a69095771560b23da56dc Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 13:30:22 +0000 Subject: [PATCH] =?UTF-8?q?Tenant=20vulnerabilities=20are=20recorded=20on?= =?UTF-8?q?=20the=20tenant's=20own=20contact=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- .../test_tenant_data_sync_orchestrator.py | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/orchestration/test_tenant_data_sync_orchestrator.py b/tests/orchestration/test_tenant_data_sync_orchestrator.py index 946e34cdb..82aeac847 100644 --- a/tests/orchestration/test_tenant_data_sync_orchestrator.py +++ b/tests/orchestration/test_tenant_data_sync_orchestrator.py @@ -253,6 +253,58 @@ def test_run_fills_secondary_phone_number_with_the_best_leftover_number( ) +# --- vulnerabilities: recorded on the tenant's own contact --- + + +def test_run_records_vulnerabilities_on_the_tenants_own_contact( + orchestrator: TenantDataSyncOrchestrator, + mock_session: MagicMock, + sdk_client: MagicMock, +) -> None: + # Arrange + mock_session.post.return_value.content = _tenancy_response( + '4007216' + "Blindness" + "Hard of hearing" + "BLINDNESS" # within-tenant duplicate + "" + '4007215' + ) + sdk_client.crm.contacts.basic_api.create.side_effect = [ + MagicMock(id="60123"), + MagicMock(id="60124"), + ] + + # Act + result = orchestrator.run(PLACE_REF, deal_id=DEAL_ID) + + # Assert + assert result == TenantDataSyncSummary( + tenancy_reference="10042020051017", + contact_ids=("60123", "60124"), + vulnerable_contact_count=1, + ) + created_properties = [ + call.kwargs["simple_public_object_input_for_create"].properties + for call in sdk_client.crm.contacts.basic_api.create.call_args_list + ] + assert created_properties == [ + { + "firstname": "Harper", + "lastname": "Solecka", + "is_vulnerable": "true", + "vulnerability_description": "Blindness\nHard of hearing", + }, + { + "firstname": "Naoimh", + "lastname": "Malyar", + "is_vulnerable": "false", + }, + ] + + def test_run_still_creates_a_contact_for_an_all_blank_signatory( orchestrator: TenantDataSyncOrchestrator, mock_session: MagicMock,