mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Map a HubSpot outcome to an abandonment reason code 🟥
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
007e561af5
commit
2512d428a1
2 changed files with 33 additions and 0 deletions
13
domain/abri/abandonment.py
Normal file
13
domain/abri/abandonment.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from typing import Optional
|
||||
|
||||
from domain.abri.models import AbandonReason
|
||||
|
||||
|
||||
def abandon_reason_for_outcome(outcome: Optional[str]) -> AbandonReason:
|
||||
"""The OpenHousing abandonment reason code for a HubSpot deal outcome.
|
||||
|
||||
The single mapping point from HubSpot's outcome to a coded reason. For now
|
||||
every outcome maps to CARDED; the real outcome-to-code table is a follow-up
|
||||
(needs Abri's code list), and swapping it in is a one-place change here.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
20
tests/domain/abri/test_abandonment.py
Normal file
20
tests/domain/abri/test_abandonment.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
|
||||
from domain.abri.abandonment import abandon_reason_for_outcome
|
||||
from domain.abri.models import AbandonReason
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"outcome",
|
||||
["no answer", "cancelled", "no show", "tenant refusal", "not viable", None],
|
||||
)
|
||||
def test_every_outcome_currently_maps_to_the_carded_reason(
|
||||
outcome: Optional[str],
|
||||
) -> None:
|
||||
# Act
|
||||
reason = abandon_reason_for_outcome(outcome)
|
||||
|
||||
# Assert
|
||||
assert reason == AbandonReason.CARDED
|
||||
Loading…
Add table
Reference in a new issue