agentic.email/backend/tests/test_email_templates.py
2026-10-05 21:34:12 +05:30

41 lines
1.4 KiB
Python

from app.services.email_templates import (
build_employee_invitation_email,
build_welcome_email,
)
def test_employee_invitation_uses_token_link_not_password():
subject, body_text, body_html = build_employee_invitation_email(
member_first_name="Anurag",
member_email="anurag@road.rentals",
manager_name="Suyash Dixit",
company_domain="road.rentals",
invite_url="https://gentic.email/invite/test-token",
expires_hours=48,
)
assert subject == "Suyash Dixit invited you to join road.rentals"
assert "password" not in body_text.lower()
assert "Sign-in credentials" not in body_text
assert "https://gentic.email/invite/test-token" in body_text
assert "expires in 48 hours" in body_text
assert "safely ignore this email" in body_text
assert "Set up your account" in body_html
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()