feat: add leads-found channel and direction_for_modality
This commit is contained in:
parent
9eda0a8830
commit
a2a839d9de
2 changed files with 21 additions and 0 deletions
|
|
@ -3,8 +3,15 @@ CHANNEL_TO_MODALITY = {
|
||||||
"voice": "voice",
|
"voice": "voice",
|
||||||
"fb-messenger": "fb_messenger",
|
"fb-messenger": "fb_messenger",
|
||||||
"nd-messenger": "nd_messenger",
|
"nd-messenger": "nd_messenger",
|
||||||
|
"leads-found": "lead_found",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OUTBOUND_MODALITIES = {"lead_found", "magpie_lead"}
|
||||||
|
|
||||||
|
|
||||||
def modality_for_channel(channel_name: str) -> str | None:
|
def modality_for_channel(channel_name: str) -> str | None:
|
||||||
return CHANNEL_TO_MODALITY.get(channel_name)
|
return CHANNEL_TO_MODALITY.get(channel_name)
|
||||||
|
|
||||||
|
|
||||||
|
def direction_for_modality(modality: str) -> str:
|
||||||
|
return "outbound" if modality in OUTBOUND_MODALITIES else "inbound"
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,17 @@ def test_unknown_channel_returns_none():
|
||||||
def test_inbox_and_general_channels_are_not_mapped():
|
def test_inbox_and_general_channels_are_not_mapped():
|
||||||
assert modality_map.modality_for_channel("inbox") is None
|
assert modality_map.modality_for_channel("inbox") is None
|
||||||
assert modality_map.modality_for_channel("general") is None
|
assert modality_map.modality_for_channel("general") is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_leads_found_channel_maps_to_lead_found_modality():
|
||||||
|
assert modality_map.modality_for_channel("leads-found") == "lead_found"
|
||||||
|
|
||||||
|
|
||||||
|
def test_direction_for_modality_outbound_for_leads():
|
||||||
|
assert modality_map.direction_for_modality("lead_found") == "outbound"
|
||||||
|
assert modality_map.direction_for_modality("magpie_lead") == "outbound"
|
||||||
|
|
||||||
|
|
||||||
|
def test_direction_for_modality_inbound_for_everything_else():
|
||||||
|
assert modality_map.direction_for_modality("bh_email") == "inbound"
|
||||||
|
assert modality_map.direction_for_modality("voice") == "inbound"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue