diff --git a/domain/abri/abandonment.py b/domain/abri/abandonment.py new file mode 100644 index 000000000..b91a25c6f --- /dev/null +++ b/domain/abri/abandonment.py @@ -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 diff --git a/tests/domain/abri/test_abandonment.py b/tests/domain/abri/test_abandonment.py new file mode 100644 index 000000000..4c0cda5f1 --- /dev/null +++ b/tests/domain/abri/test_abandonment.py @@ -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