handoff fixes
This commit is contained in:
parent
89ddebdb60
commit
8d5e9712a6
20 changed files with 1056 additions and 141 deletions
|
|
@ -41,3 +41,50 @@ async def test_send_via_smtp_uses_configured_client_hostname():
|
|||
)
|
||||
|
||||
assert send_mock.await_args.kwargs["local_hostname"] == "backend.gentic.email"
|
||||
|
||||
|
||||
def test_build_message_sets_in_reply_to_and_references():
|
||||
message = build_message(
|
||||
sender="suyash@gentic.email",
|
||||
recipients=["customer@gmail.com"],
|
||||
cc=[],
|
||||
subject="Re: fresh test",
|
||||
body_text="human said B",
|
||||
body_html=None,
|
||||
in_reply_to="<CAHabc123@mail.gmail.com>",
|
||||
references=["<CAHabc123@mail.gmail.com>"],
|
||||
message_id="<B@gentic.email>",
|
||||
)
|
||||
assert message["Message-ID"] == "<B@gentic.email>"
|
||||
assert message["In-Reply-To"] == "<CAHabc123@mail.gmail.com>"
|
||||
assert message["References"] == "<CAHabc123@mail.gmail.com>"
|
||||
raw = message.as_bytes()
|
||||
assert b"In-Reply-To: <CAHabc123@mail.gmail.com>" in raw
|
||||
assert b"References: <CAHabc123@mail.gmail.com>" in raw
|
||||
|
||||
|
||||
def test_signed_mime_preserves_in_reply_to():
|
||||
from unittest.mock import patch
|
||||
|
||||
message = build_message(
|
||||
sender="suyash@gentic.email",
|
||||
recipients=["customer@gmail.com"],
|
||||
cc=[],
|
||||
subject="Re: fresh test",
|
||||
body_text="human said B",
|
||||
body_html=None,
|
||||
in_reply_to="<CAHabc123@mail.gmail.com>",
|
||||
references=["<CAHabc123@mail.gmail.com>"],
|
||||
message_id="<B@gentic.email>",
|
||||
)
|
||||
domain = SimpleNamespace(
|
||||
domain_name="gentic.email",
|
||||
dkim_selector="agmail",
|
||||
dkim_private_key="private-key",
|
||||
)
|
||||
with patch(
|
||||
"app.services.mail_sender.dkim.sign",
|
||||
return_value=b"DKIM-Signature: test\r\n",
|
||||
):
|
||||
signed = sign_message(message, domain)
|
||||
assert b"In-Reply-To: <CAHabc123@mail.gmail.com>" in signed
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue