setting, session and profile fix

This commit is contained in:
debu-2 2026-10-07 06:16:26 +05:30
parent 068142ed61
commit a434af224c
34 changed files with 497 additions and 119 deletions

View file

@ -4,6 +4,7 @@ from unittest.mock import AsyncMock, patch
import pytest
from app.services.mail_sender import build_message, deliver_email, send_via_smtp, sign_message
from app.services.mime_body_extractor import ExtractedMimePart
def test_build_message_formats_named_sender_header():
@ -46,6 +47,32 @@ def test_build_message_adds_safe_fallback_sender_name():
assert message["From"] == "aGentic Email <notifications@gentic.email>"
def test_build_message_includes_file_attachments():
message = build_message(
sender="suyash@gentic.email",
sender_name="Suyash Dixit",
recipients=["recipient@example.com"],
cc=[],
subject="Invoice",
body_text="See attached",
body_html="<p>See attached</p>",
file_attachments=[
ExtractedMimePart(
filename="invoice.pdf",
content_type="application/pdf",
payload=b"%PDF-1.4",
)
],
)
filenames = [
part.get_filename()
for part in message.walk()
if part.get_filename()
]
assert filenames == ["invoice.pdf"]
def test_dkim_sign_uses_selector_before_domain():
message = build_message(
sender="user@ritoesis.com",