From a36fe0013224eeed681b970fa865382ff3d143e3 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 3 Jul 2026 08:28:25 +0000 Subject: [PATCH] =?UTF-8?q?Abri=20tenant=20data=20fetch=20resolves=20abri?= =?UTF-8?q?=20deals=20by=20associated=20project=20id=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- etl/hubspot/tests/test_hubspot_deal_differ.py | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/etl/hubspot/tests/test_hubspot_deal_differ.py b/etl/hubspot/tests/test_hubspot_deal_differ.py index 0a5e96e9b..660481dd2 100644 --- a/etl/hubspot/tests/test_hubspot_deal_differ.py +++ b/etl/hubspot/tests/test_hubspot_deal_differ.py @@ -808,6 +808,65 @@ def test_abri_tenant_data_fetch__no_parseable_new_commencement_date__returns_fal assert result is False +def test_abri_tenant_data_fetch__associated_abri_project_id__returns_true() -> None: + deal_id = uuid.uuid4() + + # Arrange + old_deal = make_old_deal( + id=deal_id, + project_code="Southern Retrofit", + expected_commencement_date=None, + ) + new_deal = make_new_deal( + deal_id, + project_code="Southern Retrofit", + expected_commencement_date="2026-08-01", + ) + new_project = ProjectData( + project_id=HubspotDealDiffer.ABRI_CONDITION_ASSOCIATED_PROJECT_ID, + name="Abri Condition", + ) + + # Act + result = HubspotDealDiffer.check_for_abri_tenant_data_fetch( + new_deal=new_deal, + new_project=new_project, + old_deal=old_deal, + ) + + # Assert + assert result is True + + +def test_abri_tenant_data_fetch__non_abri_project_id_with_abri_code__returns_false() -> ( + None +): + deal_id = uuid.uuid4() + + # Arrange + old_deal = make_old_deal( + id=deal_id, + project_code="Abri Condition", + expected_commencement_date=None, + ) + new_deal = make_new_deal( + deal_id, + project_code="Abri Condition", + expected_commencement_date="2026-08-01", + ) + new_project = ProjectData(project_id="999999", name="Southern Retrofit") + + # Act + result = HubspotDealDiffer.check_for_abri_tenant_data_fetch( + new_deal=new_deal, + new_project=new_project, + old_deal=old_deal, + ) + + # Assert + assert result is False + + # ======================= # DB UPDATE TRIGGER TESTS # =======================