Coverage for CIResults/tests/test_email.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-19 09:20 +0000
« prev ^ index » next coverage.py v7.6.9, created at 2024-12-19 09:20 +0000
1from django.core import mail
2from django.test import TestCase
4from CIResults.email import Email
7class EmailTests(TestCase):
8 def test_send(self):
9 with self.settings(EMAIL_ADDRESS='hello@me.com'):
10 email = Email("my subject", 'the wonderful\nmessage',
11 ['one@domain.tld', 'two@domain.tld', 'three@domain.tld'])
12 email.send()
14 self.assertEqual(len(mail.outbox), 1)
15 self.assertEqual(mail.outbox[0].to, email.to)
16 self.assertEqual(mail.outbox[0].from_email, 'hello@me.com')
17 self.assertEqual(mail.outbox[0].subject, email.subject)
18 self.assertEqual(mail.outbox[0].body, email.message)