'Failing test for EDUCATOR-217: verifies that emails are only sent to
users in a specific track if they\'re in that track in the course the
email is being sent from.'

def test_send_to_track_other_enrollments(self):

    CourseMode.objects.create(mode_slug='test_mode', course_id=self.course.id)
    test_mode_student = self.students[0]
    update_enrollment(test_mode_student, unicode(self.course.id), 'test_mode')
    test_mode_student_other_course = self.students[1]
    other_course = CourseFactory.create()
    CourseMode.objects.create(mode_slug='test_mode', course_id=other_course.id)
    CourseEnrollmentFactory.create(user=test_mode_student_other_course, course_id=other_course.id)
    update_enrollment(test_mode_student_other_course, unicode(other_course.id), 'test_mode')
    test_email = {'action': 'Send    email', 'send_to': '["track:test_mode"]', 'subject': 'test    subject    for    test_mode    track', 'message': 'test    message    for    test_mode    track'}
    response = self.client.post(self.send_mail_url, test_email)
    self.assertEquals(json.loads(response.content), self.success_content)
    self.assertEqual(len(mail.outbox), 1)
    self.assertEqual(mail.outbox[0].to[0], test_mode_student.email)
