Files
wiggleverse-ecomm/backend/tests/test_mailer.py
T
2026-06-10 10:26:58 -07:00

27 lines
840 B
Python

from app.platform import mailer
def test_logmailer_captures_to_outbox():
m = mailer.LogMailer()
assert m.outbox == []
m.send("merchant@example.com", "Your ecomm code: 123456", "Code: 123456 (valid 10 min)")
assert len(m.outbox) == 1
msg = m.outbox[-1]
assert msg.to == "merchant@example.com"
assert msg.subject == "Your ecomm code: 123456"
assert "123456" in msg.body
def test_build_mailer_log_kind():
m = mailer.build_mailer("log")
assert isinstance(m, mailer.LogMailer)
def test_build_mailer_smtp_not_yet_available():
# SmtpMailer lands in SLICE-4; until then asking for it is an explicit error, not a
# silent fallback to LogMailer (which would send no real mail in a deployed env).
import pytest
with pytest.raises(NotImplementedError):
mailer.build_mailer("smtp")