email box empty styling

This commit is contained in:
debu-2 2026-10-05 21:34:12 +05:30
parent 1ee8a58117
commit 5cb49f4cb1
19 changed files with 547 additions and 67 deletions

View file

@ -1,4 +1,7 @@
from app.services.email_templates import build_employee_invitation_email
from app.services.email_templates import (
build_employee_invitation_email,
build_welcome_email,
)
def test_employee_invitation_uses_token_link_not_password():
@ -22,3 +25,17 @@ def test_employee_invitation_uses_token_link_not_password():
assert "test-token" in body_html
assert "Initial password" not in body_html
assert "unsubscribe" not in body_html.lower()
def test_welcome_email_is_useful_not_marketing():
subject, body_text, body_html = build_welcome_email(
first_name="Anurag",
work_email="anurag@road.rentals",
organization="road.rentals",
login_url="https://gentic.email/login",
is_company_account=True,
)
assert subject == "Welcome to AGMail"
assert "AG Agent" in body_text
assert "anurag@road.rentals" in body_html
assert "unsubscribe" not in body_text.lower()

View file

@ -1,7 +1,7 @@
from types import SimpleNamespace
from unittest.mock import patch
from unittest.mock import AsyncMock, patch
from app.services.mail_sender import build_message, sign_message
from app.services.mail_sender import build_message, send_via_smtp, sign_message
def test_dkim_sign_uses_selector_before_domain():
@ -27,3 +27,17 @@ def test_dkim_sign_uses_selector_before_domain():
assert signer.call_args.args[1] == b"agmail"
assert signer.call_args.args[2] == b"ritoesis.com"
async def test_send_via_smtp_uses_configured_client_hostname():
with patch(
"app.services.mail_sender.aiosmtplib.send",
new_callable=AsyncMock,
) as send_mock:
await send_via_smtp(
b"raw",
sender="noreply@gentic.email",
recipients=["user@example.com"],
)
assert send_mock.await_args.kwargs["local_hostname"] == "backend.gentic.email"