mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Carry the deal's client_booking_reference into the Abri message 🟥
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cc23b43f40
commit
9921d545ef
1 changed files with 58 additions and 0 deletions
|
|
@ -227,6 +227,64 @@ def test_the_message_carries_the_deals_third_party_surveyor_identifier() -> None
|
|||
assert message["third_party_surveyor_identifier"] == "THIRDPARTY"
|
||||
|
||||
|
||||
def test_the_message_carries_the_deals_client_booking_reference() -> None:
|
||||
# Arrange: an amend on a deal that already carries a Job Number; the
|
||||
# consumer reads the reference off the message to decide the job exists.
|
||||
old_deal = make_old_deal(
|
||||
project_code=ABRI_PROJECT_CODE,
|
||||
confirmed_survey_date=datetime(2026, 6, 18, tzinfo=timezone.utc),
|
||||
third_party_surveyor_identifier="THIRDPARTY",
|
||||
client_booking_reference="AD0226519",
|
||||
)
|
||||
new_deal = make_new_deal(
|
||||
confirmed_survey_date="2026-06-24",
|
||||
confirmed_survey_time="14:30",
|
||||
third_party_surveyor_identifier="THIRDPARTY",
|
||||
client_booking_reference="AD0226519",
|
||||
)
|
||||
|
||||
# Act
|
||||
message = HubspotDealDiffer.check_abri_triggers_and_construct_message(
|
||||
hubspot_deal_id=DEAL_ID,
|
||||
new_deal=new_deal,
|
||||
new_project=None,
|
||||
new_listing=LISTING,
|
||||
old_deal=old_deal,
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert message is not None
|
||||
assert message["flows"] == ["amend_job"]
|
||||
assert message["client_booking_reference"] == "AD0226519"
|
||||
|
||||
|
||||
def test_the_message_omits_the_client_booking_reference_when_the_deal_has_none() -> None:
|
||||
# Arrange: a pair-completing log on a deal with no Job Number yet.
|
||||
old_deal = make_old_deal(
|
||||
project_code=ABRI_PROJECT_CODE,
|
||||
confirmed_survey_date=None,
|
||||
third_party_surveyor_identifier=None,
|
||||
)
|
||||
new_deal = make_new_deal(
|
||||
confirmed_survey_date="2026-06-24",
|
||||
confirmed_survey_time="14:30",
|
||||
third_party_surveyor_identifier="THIRDPARTY",
|
||||
)
|
||||
|
||||
# Act
|
||||
message = HubspotDealDiffer.check_abri_triggers_and_construct_message(
|
||||
hubspot_deal_id=DEAL_ID,
|
||||
new_deal=new_deal,
|
||||
new_project=None,
|
||||
new_listing=LISTING,
|
||||
old_deal=old_deal,
|
||||
)
|
||||
|
||||
# Assert
|
||||
assert message is not None
|
||||
assert message["client_booking_reference"] is None
|
||||
|
||||
|
||||
def test_a_changed_survey_date_on_a_complete_booking_builds_an_amend_job_message() -> None:
|
||||
# Arrange: a complete booking (date + surveyor) whose date moves.
|
||||
old_deal = make_old_deal(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue