From bd3c45d81c770943e4f51f31869111b3a2ad6550 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Thu, 2 Jul 2026 15:56:49 +0000 Subject: [PATCH] =?UTF-8?q?Abri=20survey=20creation=20trigger=20fires=20wh?= =?UTF-8?q?en=20confirmed=5Fsurvey=5Fdate=20is=20first=20set=20on=20an=20A?= =?UTF-8?q?bri=20Condition=20deal=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 --- etl/hubspot/hubspot_deal_differ.py | 6 ++++ etl/hubspot/tests/test_hubspot_deal_differ.py | 30 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/etl/hubspot/hubspot_deal_differ.py b/etl/hubspot/hubspot_deal_differ.py index 6d49cf590..ee189bae0 100644 --- a/etl/hubspot/hubspot_deal_differ.py +++ b/etl/hubspot/hubspot_deal_differ.py @@ -170,6 +170,12 @@ class HubspotDealDiffer: return False + @staticmethod + def check_for_abri_survey_creation( + new_deal: Dict[str, str], old_deal: HubspotDealData + ) -> bool: + raise NotImplementedError + @staticmethod def check_for_magicplan_trigger( new_deal: Dict[str, str], old_deal: HubspotDealData diff --git a/etl/hubspot/tests/test_hubspot_deal_differ.py b/etl/hubspot/tests/test_hubspot_deal_differ.py index 949524243..7ba259cae 100644 --- a/etl/hubspot/tests/test_hubspot_deal_differ.py +++ b/etl/hubspot/tests/test_hubspot_deal_differ.py @@ -343,6 +343,36 @@ def test_magicplan_trigger__outcome_surveyed_uppercase__returns_true() -> None: assert result is True +# ================================== +# ABRI SURVEY CREATION TRIGGER TESTS +# ================================== + + +def test_abri_survey_creation__date_first_set_on_abri_deal__returns_true() -> None: + deal_id = uuid.uuid4() + + # Arrange + old_deal = make_old_deal( + id=deal_id, + project_code="Abri Condition", + confirmed_survey_date=None, + ) + new_deal = make_new_deal( + deal_id, + project_code="Abri Condition", + confirmed_survey_date="2026-07-15", + ) + + # Act + result = HubspotDealDiffer.check_for_abri_survey_creation( + new_deal=new_deal, + old_deal=old_deal, + ) + + # Assert + assert result is True + + # ======================= # DB UPDATE TRIGGER TESTS # =======================