mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Fix coordination/design field names and add MagicPlan trigger to HubspotDealDiffer 🟥
This commit is contained in:
parent
1ddbb9a79d
commit
676022a4c0
2 changed files with 79 additions and 3 deletions
|
|
@ -194,6 +194,12 @@ class HubspotDealDiffer:
|
|||
and new_status != old_deal.design_status
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def check_for_magicplan_trigger(
|
||||
new_deal: Dict[str, str], old_deal: HubspotDealData
|
||||
) -> bool:
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def _lodgement_completed(
|
||||
new_deal: Dict[str, str], old_deal: HubspotDealData
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ def test_pashub_trigger__coordination_completed_and_pashub_link_set__returns_tru
|
|||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
pashub_link="www.google.co.uk",
|
||||
coordination_status=coordination_status,
|
||||
**{"coordination_status__stage_1_": coordination_status},
|
||||
)
|
||||
|
||||
assert (
|
||||
|
|
@ -156,7 +156,7 @@ def test_pashub_trigger__design_completed_and_pashub_link_set__returns_true() ->
|
|||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
pashub_link="www.google.co.uk",
|
||||
design_status="uploaded",
|
||||
retrofit_design_status="uploaded",
|
||||
)
|
||||
|
||||
assert (
|
||||
|
|
@ -177,7 +177,7 @@ def test_pashub_trigger__design_completed_and_pashub_link_not_set__returns_false
|
|||
|
||||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
design_status="uploaded",
|
||||
retrofit_design_status="uploaded",
|
||||
)
|
||||
|
||||
assert (
|
||||
|
|
@ -270,6 +270,76 @@ def test_pashub_trigger__coordination_design_lodgement_not_completed_and_pashub_
|
|||
)
|
||||
|
||||
|
||||
# ==========================
|
||||
# MAGICPLAN TRIGGER TESTS
|
||||
# ==========================
|
||||
|
||||
|
||||
def test_magicplan_trigger__transitions_to_coordination_complete__returns_true() -> None:
|
||||
deal_id = uuid.uuid4()
|
||||
|
||||
# Arrange
|
||||
old_deal = make_old_deal(id=deal_id, coordination_status="in progress")
|
||||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
**{"coordination_status__stage_1_": "(v1) ioe/mtp complete"},
|
||||
)
|
||||
|
||||
# Act
|
||||
result = HubspotDealDiffer.check_for_magicplan_trigger(
|
||||
new_deal=new_deal,
|
||||
old_deal=old_deal,
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert result is True
|
||||
|
||||
|
||||
def test_magicplan_trigger__already_in_coordination_complete_unrelated_change__returns_false() -> None:
|
||||
deal_id = uuid.uuid4()
|
||||
|
||||
# Arrange
|
||||
old_deal = make_old_deal(
|
||||
id=deal_id,
|
||||
coordination_status="(v1) ioe/mtp complete",
|
||||
outcome="pending",
|
||||
)
|
||||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
**{"coordination_status__stage_1_": "(v1) ioe/mtp complete"},
|
||||
outcome="won",
|
||||
)
|
||||
|
||||
# Act
|
||||
result = HubspotDealDiffer.check_for_magicplan_trigger(
|
||||
new_deal=new_deal,
|
||||
old_deal=old_deal,
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert result is False
|
||||
|
||||
|
||||
def test_magicplan_trigger__transitions_to_non_complete_coordination_status__returns_false() -> None:
|
||||
deal_id = uuid.uuid4()
|
||||
|
||||
# Arrange
|
||||
old_deal = make_old_deal(id=deal_id, coordination_status="in progress")
|
||||
new_deal = make_new_deal(
|
||||
deal_id,
|
||||
**{"coordination_status__stage_1_": "design submitted"},
|
||||
)
|
||||
|
||||
# Act
|
||||
result = HubspotDealDiffer.check_for_magicplan_trigger(
|
||||
new_deal=new_deal,
|
||||
old_deal=old_deal,
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert result is False
|
||||
|
||||
|
||||
# =======================
|
||||
# DB UPDATE TRIGGER TESTS
|
||||
# =======================
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue