As a feature request, it would be nice if the Mock SES backend kept the actual email content in the sent_messages list, and made it easy to make assertions against them.
I think two things would be needed:
The Message class would have to capture actual content of the emails.
The backend would have to expose those messages somehow so test code could assert against them.
I'm imagining something like
with fake_ses() as mock_ses:
... # tests that trigger sending email
assert '[email protected]' in mock_ses.sent_messages[0].recipients
@bjmc The SES backend state is available on the SES module, e.g:
from boto.ses import ses_backend
assert ses_backend.sent_messages[0]
Going to close this. @r1b 's suggestion is our current best practice.
@bjmc The SES backend state is available on the SES module, e.g:
from boto.ses import ses_backend assert ses_backend.sent_messages[0]
For future readers, ses_backend is available on moto not boto:
from moto.ses import ses_backend
# ^^^^
assert ses_backend.sent_messages[0]
Most helpful comment
For future readers,
ses_backendis available onmotonotboto: