responsiveness fix
This commit is contained in:
parent
4ad05bf137
commit
f7a4753217
9 changed files with 396 additions and 13 deletions
|
|
@ -7,6 +7,7 @@ from app.services.human_handoff_service import (
|
|||
_mirror_from_identity,
|
||||
build_handoff_subject,
|
||||
maybe_trigger_handoff,
|
||||
parse_human_initiated_subject,
|
||||
process_human_reply,
|
||||
redact_human_address,
|
||||
resolve_handoff_from_inbound,
|
||||
|
|
@ -97,6 +98,32 @@ def test_mirror_from_stays_on_gentic_address():
|
|||
assert agent_address == "suyash@gentic.email"
|
||||
|
||||
|
||||
def test_human_initiated_subject_accepts_dot_hyphen_and_bar():
|
||||
assert parse_human_initiated_subject(
|
||||
"handoff · Suyash Dixit · suyashdixit091@gmail.com · hello"
|
||||
) == {
|
||||
"customer_name": "Suyash Dixit",
|
||||
"customer_email": "suyashdixit091@gmail.com",
|
||||
"subject": "hello",
|
||||
}
|
||||
assert parse_human_initiated_subject(
|
||||
"handoff - Suyash Dixit - suyashdixit091@gmail.com - Need a quote"
|
||||
)["subject"] == "Need a quote"
|
||||
parsed = parse_human_initiated_subject(
|
||||
"Re: handoff | Suyash Dixit | SuyashDixit091@gmail.com | hello - there"
|
||||
)
|
||||
assert parsed["customer_email"] == "suyashdixit091@gmail.com"
|
||||
assert parsed["customer_name"] == "Suyash Dixit"
|
||||
assert parsed["subject"] == "hello - there"
|
||||
|
||||
|
||||
def test_human_initiated_subject_rejects_incomplete_patterns():
|
||||
assert parse_human_initiated_subject("Suyash Dixit · handoff · a@b.com · hello") is None
|
||||
assert parse_human_initiated_subject("handoff · Suyash Dixit · not-an-email · hello") is None
|
||||
assert parse_human_initiated_subject("handoff-Suyash Dixit-a@b.com-hello") is None
|
||||
assert parse_human_initiated_subject("hello from the customer") is None
|
||||
|
||||
|
||||
def test_private_subject_contains_customer_name_and_external_subject():
|
||||
subject = build_handoff_subject(
|
||||
sender_name="Parth Dixit",
|
||||
|
|
@ -104,7 +131,7 @@ def test_private_subject_contains_customer_name_and_external_subject():
|
|||
external_subject="Invoice 42",
|
||||
)
|
||||
assert subject == (
|
||||
"Parth Dixit · handoff · parthdixit091@gmail.com · Invoice 42"
|
||||
"handoff · Parth Dixit · parthdixit091@gmail.com · Invoice 42"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue