diff --git a/progress.md b/progress.md index f380fef..87fc19c 100644 --- a/progress.md +++ b/progress.md @@ -1,5 +1,19 @@ # Progress +## Branded emails (2026-10-06) + +### Done + +- `templates/emails/trivia_tap_wrapper.html`: TriviaTap wrapper for every auth mail, dark like the app. Near-black card with logo and name, white title, code centered in a mint gradient box, mint gradient pill button, and a "Need help?" footer pointing to developers@bwh.tech. Picked over a minimal light and a playful mascot design. +- `send_mail` sets Reply-To to developers@bwh.tech, so a reply reaches support instead of noreply. +- Test: the queued mail carries the logo, the support link and the Reply-To header. + +### Notes + +- Styles live in the wrapper's ` + + + + + + + + + + + diff --git a/trivia_tap/tests/test_auth.py b/trivia_tap/tests/test_auth.py index f8b80e9..5c84248 100644 --- a/trivia_tap/tests/test_auth.py +++ b/trivia_tap/tests/test_auth.py @@ -2,7 +2,9 @@ from urllib.parse import parse_qs, urlsplit import frappe +from frappe.email.email_body import get_formatted_html from frappe.tests import IntegrationTestCase +from frappe.utils.jinja import get_email_from_template from frappe.utils.oauth import consume_oauth_state, update_oauth_user from frappe.utils.password import check_password @@ -16,7 +18,7 @@ send_reset_link, sign_up, ) -from trivia_tap.email_code import MAX_TRIES +from trivia_tap.email_code import MAX_TRIES, send_mail from trivia_tap.patches import brand_site EMAIL = "new.host@example.com" @@ -303,3 +305,17 @@ def test_google_sign_up_lands_as_a_quiz_host(self): self.assertIn("Quiz Host", frappe.get_roles(EMAIL)) self.assertEqual(user.user_type, "System User") self.assertEqual(user.get_social_login_userid("google"), "google-123") + + +class TestMail(IntegrationTestCase): + @patch("trivia_tap.email_code.frappe.sendmail") + def test_mail_carries_the_brand_and_support_address(self, sendmail): + send_mail(EMAIL, "Your TriviaTap log in code", "trivia_tap_code", {"code": "042917", "minutes": 10}) + + mail = sendmail.call_args.kwargs + self.assertEqual(mail["reply_to"], "developers@bwh.tech") + content = get_email_from_template(mail["template"], mail["args"])[0] + message = get_formatted_html(mail["subject"], content, wrapper=mail["wrapper"]) + self.assertIn("042917", message) + self.assertIn("trivia-tap-logo.png", message) + self.assertIn("mailto:developers@bwh.tech", message)