feat(slice-2): platform/mailer port + LogMailer (dev channel, §6.2/PUC-10)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user