Black formatting

This commit is contained in:
Scot Hacker 2018-12-21 00:38:44 -08:00
parent f526ed5166
commit 21ec87cee4
10 changed files with 276 additions and 227 deletions

View file

@ -9,7 +9,7 @@ from todo.utils import send_notify_mail, send_email_to_thread_participants
@pytest.fixture()
# Set up an in-memory mail server to receive test emails
def email_backend_setup(settings):
settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
settings.EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
def test_send_notify_mail_not_me(todo_setup, django_user_model, email_backend_setup):
@ -46,13 +46,17 @@ def test_send_email_to_thread_participants(todo_setup, django_user_model, email_
u1 = django_user_model.objects.get(username="u1")
task = Task.objects.filter(created_by=u1).first()
u3 = django_user_model.objects.create_user(username="u3", password="zzz", email="u3@example.com")
u4 = django_user_model.objects.create_user(username="u4", password="zzz", email="u4@example.com")
Comment.objects.create(author=u3, task=task, body="Hello", )
Comment.objects.create(author=u4, task=task, body="Hello", )
u3 = django_user_model.objects.create_user(
username="u3", password="zzz", email="u3@example.com"
)
u4 = django_user_model.objects.create_user(
username="u4", password="zzz", email="u4@example.com"
)
Comment.objects.create(author=u3, task=task, body="Hello")
Comment.objects.create(author=u4, task=task, body="Hello")
send_email_to_thread_participants(task, "test body", u1)
assert len(mail.outbox) == 1 # One message to multiple recipients
assert 'u1@example.com' in mail.outbox[0].recipients()
assert 'u3@example.com' in mail.outbox[0].recipients()
assert 'u4@example.com' in mail.outbox[0].recipients()
assert "u1@example.com" in mail.outbox[0].recipients()
assert "u3@example.com" in mail.outbox[0].recipients()
assert "u4@example.com" in mail.outbox[0].recipients()