31 lines
809 B
Python
31 lines
809 B
Python
from django.core import mail as django_mail
|
|
from django.test import SimpleTestCase
|
|
|
|
from ..emails import AbstractMail
|
|
from .generic import EmailTestMixin
|
|
|
|
|
|
class ConcreteMail(AbstractMail):
|
|
_subject = u'No subject'
|
|
_template_name = 'dav_base/base.html'
|
|
|
|
def __init__(self, recipient, *args, **kwargs):
|
|
self._recipient = recipient
|
|
|
|
def _get_recipients(self):
|
|
return [self._recipient]
|
|
|
|
|
|
class TestCase(EmailTestMixin, SimpleTestCase):
|
|
def test_send(self):
|
|
recipient = 'root@localhost'
|
|
email = ConcreteMail(recipient)
|
|
email.send()
|
|
|
|
self.assertEqual(len(django_mail.outbox), 1)
|
|
mail = django_mail.outbox[0]
|
|
|
|
self.assertSender(mail)
|
|
self.assertRecipients(mail, [recipient])
|
|
self.assertSubject(mail, u'No subject')
|