-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sent emails when new user fills out profile and their profile matches…
… query (#2782) * Send emails when new user fills out their profile * Combine excepts * Make failed_recipient_emails * Lint * Set query * Move send_automatic_emails to task * Add except clause for IntegrityError * Make factories * Use side_effect * Use different mock * Use fake sender_name
- Loading branch information
George Schneeloch
authored
Mar 15, 2017
1 parent
f47555d
commit 9cfc3ab
Showing
19 changed files
with
661 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Factories for mail models""" | ||
from factory import ( | ||
Faker, | ||
SubFactory, | ||
) | ||
from factory.django import DjangoModelFactory | ||
from factory.fuzzy import FuzzyText | ||
|
||
from mail.models import AutomaticEmail | ||
from search.factories import PercolateQueryFactory | ||
|
||
|
||
class AutomaticEmailFactory(DjangoModelFactory): | ||
"""Factory for AutomaticEmail""" | ||
query = SubFactory(PercolateQueryFactory) | ||
enabled = Faker('boolean') | ||
email_subject = FuzzyText() | ||
email_body = FuzzyText() | ||
sender_name = Faker('name') | ||
|
||
class Meta: | ||
model = AutomaticEmail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.5 on 2017-03-06 15:34 | ||
from __future__ import unicode_literals | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('mail', '0004_automaticemail'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='SentAutomaticEmail', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_on', models.DateTimeField(auto_now_add=True)), | ||
('updated_on', models.DateTimeField(auto_now=True)), | ||
('automatic_email', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mail.AutomaticEmail')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='sentautomaticemail', | ||
unique_together=set([('user', 'automatic_email')]), | ||
), | ||
] |
Oops, something went wrong.