email template

This commit is contained in:
debu-2 2026-10-05 21:00:05 +05:30
parent ebbb582e99
commit 2451045693
15 changed files with 447 additions and 156 deletions

View file

@ -1,30 +1,24 @@
from app.services.email_templates import build_employee_invitation_email
def test_employee_invitation_uses_gentic_branding():
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",
manager_email="suyash@road.rentals",
company_domain="road.rentals",
login_url="https://gentic.email/login",
initial_password="Roadrentals123",
force_password_change=True,
invite_url="https://gentic.email/invite/test-token",
expires_hours=48,
)
assert subject == "Suyash Dixit invited you to join road.rentals"
assert "AGMail" not in subject
assert "aGentic Email" not in subject
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 "aGentic Email" in body_text
assert "AGMail" not in body_text
assert "You are receiving this because Suyash Dixit invited you" in body_text
assert "cannot unsubscribe from required account emails" in body_text
assert "anurag@road.rentals" in body_text
assert "gentic.email" in body_html
assert "Work email invitation" in body_html
assert "invited you to join" in body_html
assert "Sign in to aGentic Email" in body_html
assert "AGMail" not in body_html
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()

View file

@ -0,0 +1,8 @@
import hashlib
from app.services.member_invitations import hash_invite_token
def test_hash_invite_token_is_sha256_hex():
token = "example-token"
assert hash_invite_token(token) == hashlib.sha256(token.encode("utf-8")).hexdigest()