From 76896f9a8edd40b84fc23f426eeca4a6021c2a99 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 6 Jul 2026 14:05:42 +0000 Subject: [PATCH] rename tenant data sync to abri tenant data sync --- ... => abri_tenant_data_sync_orchestrator.py} | 6 +-- ...est_abri_tenant_data_sync_orchestrator.py} | 44 +++++++++---------- 2 files changed, 23 insertions(+), 27 deletions(-) rename orchestration/{tenant_data_sync_orchestrator.py => abri_tenant_data_sync_orchestrator.py} (96%) rename tests/orchestration/{test_tenant_data_sync_orchestrator.py => test_abri_tenant_data_sync_orchestrator.py} (93%) diff --git a/orchestration/tenant_data_sync_orchestrator.py b/orchestration/abri_tenant_data_sync_orchestrator.py similarity index 96% rename from orchestration/tenant_data_sync_orchestrator.py rename to orchestration/abri_tenant_data_sync_orchestrator.py index f1e5bb3e0..14ab68e2f 100644 --- a/orchestration/tenant_data_sync_orchestrator.py +++ b/orchestration/abri_tenant_data_sync_orchestrator.py @@ -85,7 +85,7 @@ class TenantDataSyncError(Exception): ) -class TenantDataSyncOrchestrator: +class AbriTenantDataSyncOrchestrator: """Syncs an Abri tenancy's signatories to a HubSpot deal. Tenant data flows straight from Abri to HubSpot; nothing is persisted @@ -110,9 +110,7 @@ class TenantDataSyncOrchestrator: associated_ids: List[str] = [] for tenant_index, tenant in enumerate(tenancy.tenants): try: - contact_id = self._hubspot.create_contact( - _contact_properties(tenant) - ) + contact_id = self._hubspot.create_contact(_contact_properties(tenant)) contact_ids.append(contact_id) self._hubspot.associate_contact_to_deal( deal_id=deal_id, contact_id=contact_id diff --git a/tests/orchestration/test_tenant_data_sync_orchestrator.py b/tests/orchestration/test_abri_tenant_data_sync_orchestrator.py similarity index 93% rename from tests/orchestration/test_tenant_data_sync_orchestrator.py rename to tests/orchestration/test_abri_tenant_data_sync_orchestrator.py index 3bbfbe439..ad7a738b5 100644 --- a/tests/orchestration/test_tenant_data_sync_orchestrator.py +++ b/tests/orchestration/test_abri_tenant_data_sync_orchestrator.py @@ -15,9 +15,9 @@ from infrastructure.hubspot.deal_contacts_client import HubspotDealContactsClien from infrastructure.abri.abri_client import AbriClient from infrastructure.abri.config import AbriConfig from infrastructure.abri.errors import AbriResponseParseError, AbriTransportError -from orchestration.tenant_data_sync_orchestrator import ( +from orchestration.abri_tenant_data_sync_orchestrator import ( TenantDataSyncError, - TenantDataSyncOrchestrator, + AbriTenantDataSyncOrchestrator, TenantDataSyncSummary, ) @@ -62,13 +62,13 @@ def sdk_client() -> MagicMock: @pytest.fixture() def orchestrator( mock_session: MagicMock, sdk_client: MagicMock -) -> TenantDataSyncOrchestrator: +) -> AbriTenantDataSyncOrchestrator: with patch( "infrastructure.abri.abri_client.requests.Session", return_value=mock_session, ): abri_client = AbriClient(config=CONFIG) - return TenantDataSyncOrchestrator( + return AbriTenantDataSyncOrchestrator( abri_client=abri_client, hubspot=HubspotDealContactsClient(sdk_client=sdk_client), ) @@ -78,7 +78,7 @@ def orchestrator( def test_run_sends_the_recorded_getscstenantdata_envelope_to_the_relay_endpoint( - orchestrator: TenantDataSyncOrchestrator, mock_session: MagicMock + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock ) -> None: # Arrange mock_session.post.return_value.content = _tenancy_response("") @@ -100,7 +100,7 @@ def test_run_sends_the_recorded_getscstenantdata_envelope_to_the_relay_endpoint( def test_run_creates_an_associated_deal_contact_per_signatory_and_returns_a_summary( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -145,7 +145,7 @@ def test_run_creates_an_associated_deal_contact_per_signatory_and_returns_a_summ def test_run_creates_a_separate_contact_for_each_signatory( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -194,7 +194,7 @@ def test_run_creates_a_separate_contact_for_each_signatory( def test_run_picks_the_best_priority_number_of_each_kind_for_a_contact( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -216,17 +216,15 @@ def test_run_picks_the_best_priority_number_of_each_kind_for_a_contact( 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 - ) + 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_fills_secondary_phone_number_with_the_best_leftover_number( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -263,7 +261,7 @@ def test_run_fills_secondary_phone_number_with_the_best_leftover_number( def test_run_records_vulnerabilities_on_the_tenants_own_contact( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -312,7 +310,7 @@ def test_run_records_vulnerabilities_on_the_tenants_own_contact( def test_run_still_creates_a_contact_for_an_all_blank_signatory( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -342,7 +340,7 @@ def test_run_still_creates_a_contact_for_an_all_blank_signatory( def test_run_treats_a_tenancy_with_no_signatories_as_a_valid_zero_contact_outcome( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -365,7 +363,7 @@ def test_run_treats_a_tenancy_with_no_signatories_as_a_valid_zero_contact_outcom def test_run_returns_the_abri_rejection_verbatim_and_makes_no_hubspot_calls( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -398,7 +396,7 @@ def test_run_returns_the_abri_rejection_verbatim_and_makes_no_hubspot_calls( ], ) def test_run_raises_a_retriable_parse_error_on_an_unexpectedly_shaped_response( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, body: bytes, @@ -413,7 +411,7 @@ def test_run_raises_a_retriable_parse_error_on_an_unexpectedly_shaped_response( def test_run_raises_a_transport_error_when_the_relay_is_unreachable( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -445,7 +443,7 @@ def _pii_echoing_api_error() -> ContactsApiException: def test_run_raises_an_error_scrubbed_of_the_hubspot_response_body( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -471,7 +469,7 @@ def test_run_raises_an_error_scrubbed_of_the_hubspot_response_body( def test_run_fails_fast_when_association_fails_and_reports_the_orphaned_contact( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: @@ -502,7 +500,7 @@ def test_run_fails_fast_when_association_fails_and_reports_the_orphaned_contact( def test_run_retries_a_rate_limited_hubspot_call_before_succeeding( - orchestrator: TenantDataSyncOrchestrator, + orchestrator: AbriTenantDataSyncOrchestrator, mock_session: MagicMock, sdk_client: MagicMock, ) -> None: