mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
A changed booking amends the deal's OpenHousing appointment 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a93346ec7f
commit
9bae8df6ea
4 changed files with 33 additions and 4 deletions
|
|
@ -233,7 +233,19 @@ class AbriOrchestrator:
|
|||
def amend_job(
|
||||
self, booking: ConfirmedSurveyBooking
|
||||
) -> AmendJobOrchestrationResult:
|
||||
raise NotImplementedError
|
||||
job_no = self._deal_database.job_no_for_deal(booking.deal_id)
|
||||
if job_no is None:
|
||||
raise JobNoNotYetRecordedError(deal_id=booking.deal_id)
|
||||
|
||||
return self._abri.amend_job(
|
||||
AmendJobRequest(
|
||||
job_no=job_no,
|
||||
appointment_date=booking.confirmed_survey_date,
|
||||
appointment_time=slot_for_confirmed_time(
|
||||
booking.confirmed_survey_time
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
def log_job(self, booking: ConfirmedSurveyBooking) -> LogJobOrchestrationResult:
|
||||
descriptions = build_job_descriptions(booking.deal_name)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ All tenant details below are fictional (Ofcom-reserved number ranges).
|
|||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any, List, cast
|
||||
from typing import Any, List, Optional, cast
|
||||
|
||||
from dotenv import dotenv_values
|
||||
from hubspot.client import Client # type: ignore[reportMissingTypeStubs]
|
||||
|
|
@ -101,11 +101,14 @@ def _stubbed_abri_client() -> AbriClient:
|
|||
|
||||
|
||||
class _UnusedDealDatabase:
|
||||
"""Satisfies the gateway dependency; the tenant-data flow never writes it."""
|
||||
"""Satisfies the gateway dependency; the tenant-data flow never touches it."""
|
||||
|
||||
def record_job_no(self, deal_id: str, job_no: str) -> None:
|
||||
raise AssertionError("tenant-data sync must not touch the deal database")
|
||||
|
||||
def job_no_for_deal(self, deal_id: str) -> Optional[str]:
|
||||
raise AssertionError("tenant-data sync must not touch the deal database")
|
||||
|
||||
|
||||
def _archive_contacts(sdk_client: Client) -> None:
|
||||
if not CONTACT_IDS_TO_ARCHIVE:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import traceback
|
|||
import xml.etree.ElementTree as ET
|
||||
from datetime import date
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
from typing import List, Optional, Tuple
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -57,6 +57,16 @@ class FakeDealDatabase:
|
|||
def record_job_no(self, deal_id: str, job_no: str) -> None:
|
||||
self.recorded_job_nos.append((deal_id, job_no))
|
||||
|
||||
def job_no_for_deal(self, deal_id: str) -> Optional[str]:
|
||||
return next(
|
||||
(
|
||||
job_no
|
||||
for recorded_deal_id, job_no in self.recorded_job_nos
|
||||
if recorded_deal_id == deal_id
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def mock_session() -> MagicMock:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import json
|
|||
import traceback
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -66,6 +67,9 @@ class FakeDealDatabase:
|
|||
def record_job_no(self, deal_id: str, job_no: str) -> None:
|
||||
raise AssertionError("tenant-data sync must not touch the deal database")
|
||||
|
||||
def job_no_for_deal(self, deal_id: str) -> Optional[str]:
|
||||
raise AssertionError("tenant-data sync must not touch the deal database")
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def orchestrator(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue