human handoffs
This commit is contained in:
parent
79188e0f59
commit
36a55930f9
35 changed files with 4039 additions and 139 deletions
30
backend/tests/test_reply_recipients.py
Normal file
30
backend/tests/test_reply_recipients.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
from app.services.reply_recipients import reply_recipients
|
||||
|
||||
|
||||
def test_reply_prefers_reply_to_header():
|
||||
message = {
|
||||
"sender": {"name": "Sender", "address": "sender@example.com"},
|
||||
"reply_to": [{"name": "Support", "address": "support@example.com"}],
|
||||
"to": [{"name": "Me", "address": "me@gentic.email"}],
|
||||
"cc": [],
|
||||
}
|
||||
to, cc = reply_recipients(message=message, viewer_email="me@gentic.email", reply_all=False)
|
||||
assert to == ["support@example.com"]
|
||||
assert cc == []
|
||||
|
||||
|
||||
def test_reply_all_excludes_viewer_and_deduplicates():
|
||||
message = {
|
||||
"sender": {"name": "Sender", "address": "sender@example.com"},
|
||||
"to": [
|
||||
{"name": "Me", "address": "me@gentic.email"},
|
||||
{"name": "Other", "address": "other@example.com"},
|
||||
],
|
||||
"cc": [
|
||||
{"name": "Sender", "address": "sender@example.com"},
|
||||
{"name": "Third", "address": "third@example.com"},
|
||||
],
|
||||
}
|
||||
to, cc = reply_recipients(message=message, viewer_email="me@gentic.email", reply_all=True)
|
||||
assert to == ["sender@example.com"]
|
||||
assert set(cc) == {"other@example.com", "third@example.com"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue