Bulk Email Cohorts (#12602)

Adds cohorts as valid bulk email targets.
This commit is contained in:
Eric Fischer
2016-06-06 16:32:59 -04:00
parent 740266bd82
commit faa7f544d2
15 changed files with 404 additions and 193 deletions

View File

@@ -56,7 +56,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(SharedModuleStoreTestCase):
response = self.client.get(self.url)
self.assertIn(self.email_link, response.content)
send_to_label = '<ul role="group" aria-label="Send to:">'
send_to_label = '<div class="send_to_list">Send to:</div>'
self.assertTrue(send_to_label in response.content)
self.assertEqual(response.status_code, 200)

View File

@@ -31,7 +31,7 @@ class FakeContentTask(FakeInfo):
def __init__(self, email_id, num_sent, num_failed, sent_to):
super(FakeContentTask, self).__init__()
self.task_input = {'email_id': email_id, 'to_option': sent_to}
self.task_input = {'email_id': email_id}
self.task_input = json.dumps(self.task_input)
self.task_output = {'succeeded': num_sent, 'failed': num_failed}
self.task_output = json.dumps(self.task_output)
@@ -51,20 +51,6 @@ 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
@@ -75,7 +61,23 @@ 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()
self.targets = FakeTargetGroup()
class FakeTarget(object):
""" Corresponding fake target for a fake email """
target_type = "expected"
def long_display(self):
""" Mocks out a class method """
return self.target_type
class FakeTargetGroup(object):
""" Mocks out the M2M relationship between FakeEmail and FakeTarget """
def all(self):
""" Mocks out a django method """
return [FakeTarget()]
class FakeEmailInfo(FakeInfo):