handoff fixes
This commit is contained in:
parent
aabb63f947
commit
3f4bcc26d9
4 changed files with 137 additions and 28 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from app.services.handoff_evaluator import evaluate_handoff
|
||||
from app.services.handoff_evaluator import ALL_MAIL_LABEL, ALL_TYPES_ID, evaluate_handoff
|
||||
|
||||
|
||||
def test_handoff_requires_all_selected_filters():
|
||||
|
|
@ -31,3 +31,35 @@ def test_handoff_does_not_match_unrelated_instruction():
|
|||
instructions="Forward when a refund requires approval.",
|
||||
)
|
||||
assert result["would_handoff"] is False
|
||||
|
||||
|
||||
def test_handoff_all_mail_matches_generic_inbound():
|
||||
email = {
|
||||
"subject": "test handoff",
|
||||
"snippet": "did you receive this?",
|
||||
"body_text": "did you receive this?",
|
||||
}
|
||||
result = evaluate_handoff(
|
||||
email=email,
|
||||
labels=[ALL_MAIL_LABEL],
|
||||
email_types=[ALL_TYPES_ID],
|
||||
instructions="",
|
||||
)
|
||||
assert result["would_handoff"] is True
|
||||
assert result["label_matched"] is True
|
||||
assert result["type_matched"] is True
|
||||
|
||||
|
||||
def test_handoff_selected_categories_do_not_match_generic_email():
|
||||
email = {
|
||||
"subject": "hi",
|
||||
"snippet": "check the inbox please",
|
||||
"body_text": "check the inbox please",
|
||||
}
|
||||
result = evaluate_handoff(
|
||||
email=email,
|
||||
labels=["Important", "Finance", "Clients"],
|
||||
email_types=["transactional"],
|
||||
instructions="",
|
||||
)
|
||||
assert result["would_handoff"] is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue