Amend the Abri booking when the deal's surveyor changes 🟥

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-20 08:33:45 +00:00
parent 18dfda038d
commit f91eb468cf

View file

@ -118,6 +118,35 @@ def test_a_changed_confirmed_survey_date_builds_an_amend_job_message() -> None:
assert message["confirmed_survey_date"] == "2026-06-24"
def test_a_changed_surveyor_on_a_booked_deal_builds_an_amend_job_message() -> None:
# Arrange: booking exists; only the surveyor changes.
old_deal = make_old_deal(
project_code=ABRI_PROJECT_CODE,
confirmed_survey_date=datetime(2026, 6, 24, tzinfo=timezone.utc),
confirmed_survey_time="14:30",
third_party_surveyor_identifier="OLDSURVEYOR",
)
new_deal = make_new_deal(
confirmed_survey_date="2026-06-24",
confirmed_survey_time="14:30",
third_party_surveyor_identifier="NEWSURVEYOR",
)
# 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["third_party_surveyor_identifier"] == "NEWSURVEYOR"
def test_a_first_expected_commencement_date_builds_a_tenant_sync_message() -> None:
# Arrange
old_deal = make_old_deal(