Bulk Email Multiselect (#12301)

TNL-4356

Allows multiple bulk email targets to be specified at once.

-The previous "All" option has been split into "Staff" and "Learners"
-The backend changes made here lay the groundwork for cohort emailing
-The data migration, 0005, is somewhat large and requires deploy attention
-Tests have been updated
-Numerous safe-commit-linter fixes are included
This commit is contained in:
Eric Fischer
2016-05-26 14:22:04 -04:00
parent 37eedf07db
commit a9a3fabfe8
26 changed files with 738 additions and 360 deletions

View File

@@ -51,6 +51,20 @@ class FakeEmail(FakeInfo):
'created',
]
class FakeTarget(object):
""" Corresponding fake target for a fake email """
target_type = "expected"
def get_target_type_display(self):
""" Mocks out a django method """
return self.target_type
class FakeTargetGroup(object):
""" Helps to mock out a django M2M relationship """
def all(self):
""" Mocks out a django method """
return [FakeEmail.FakeTarget()]
def __init__(self, email_id):
super(FakeEmail, self).__init__()
self.id = unicode(email_id) # pylint: disable=invalid-name
@@ -61,6 +75,7 @@ class FakeEmail(FakeInfo):
hour = random.randint(0, 23)
minute = random.randint(0, 59)
self.created = datetime.datetime(year, month, day, hour, minute, tzinfo=utc)
self.targets = FakeEmail.FakeTargetGroup()
class FakeEmailInfo(FakeInfo):
@@ -91,3 +106,4 @@ class FakeEmailInfo(FakeInfo):
fake_email_dict = fake_email.to_dict()
self.email = {feature: fake_email_dict[feature] for feature in self.EMAIL_FEATURES}
self.requester = u'expected'
self.sent_to = [u'expected']