Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- During tests every outgoing email instead of being sent
- to outer world is saved in django.core.mail.outbox.
- """
- from django.core import mail
- def test_send_mail():
- mail.send_mail(
- 'Example subject',
- 'Message body.'
- 'from@example.net',
- ['to@example.net']
- )
- assert len(mail.outbox) == 1, "Inbox is not empty"
- assert mail.outbox[0].subject == 'Example subject'
- assert mail.outbox[0].body == 'Message body.'
- assert mail.outbox[0].from_email == 'from@example.net'
- assert mail.outbox[0].to == ['to@example.net']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement