UPD: More and better tests.

This commit is contained in:
2019-03-29 16:56:44 +01:00
parent 80e9271209
commit 4c1c6b48df
6 changed files with 244 additions and 35 deletions

View File

@@ -3,6 +3,7 @@ import os
from django.apps import apps
from django.contrib.auth.models import AbstractUser
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core import mail as django_mail
from django.test import SimpleTestCase, TestCase, tag
from django.urls import reverse
from selenium import webdriver
@@ -44,6 +45,15 @@ class EmailTestMixin(object):
email_base_url = 'http://localhost'
email_subject_prefix = '[Test]'
def get_mail_for_user(self, user):
recipient = '"{fullname}" <{email}>'.format(fullname=user.get_full_name(), email=user.email)
mails = []
for mail in django_mail.outbox:
if recipient in mail.recipients():
mails.append(mail)
return mails
def assertSender(self, mail):
self.assertEqual(mail.from_email, self.email_sender)