Coverage for fastid / notify / utils.py: 100%
14 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-10-18 16:37 +0000
1from collections.abc import Iterable
2from pathlib import Path
4from fastid.core.config import branding_settings
5from fastid.notify.models import EmailTemplate, TelegramTemplate
8def collect_email_templates() -> Iterable[EmailTemplate]:
9 with Path("templates/notifications/html/base.html").open() as f:
10 base = EmailTemplate(slug="base", subject="Base", source=f.read())
11 with Path("templates/notifications/html/code.html").open() as f:
12 code = EmailTemplate(slug="code", subject="Your verification code", source=f.read())
13 with Path("templates/notifications/html/welcome.html").open() as f:
14 welcome = EmailTemplate(slug="welcome", subject=f"Welcome to {branding_settings.title}", source=f.read())
15 return [base, code, welcome]
18def collect_telegram_templates() -> Iterable[TelegramTemplate]:
19 with Path("templates/notifications/md/code.md").open() as f:
20 code = TelegramTemplate(slug="code", source=f.read())
21 with Path("templates/notifications/md/welcome.md").open() as f:
22 welcome = TelegramTemplate(slug="welcome", source=f.read())
23 return [code, welcome]