'Verify that certificates are generated for all white-listed students,
whether or not they already had certs generated for them.'

@ddt.data(CertificateStatuses.downloadable, CertificateStatuses.generating, CertificateStatuses.notpassing, CertificateStatuses.audit_passing)
def test_certificate_generation_all_whitelisted(self, status):

    students = self._create_students(5)
    for student in students[:3]:
        CertificateWhitelistFactory.create(user=student, course_id=self.course.id, whitelist=True)
    for student in students[:2]:
        GeneratedCertificateFactory.create(user=student, course_id=self.course.id, status=status)
    task_input = {'student_set': 'all_whitelisted'}
    expected_results = {'action_name': 'certificates    generated', 'total': 3, 'attempted': 3, 'succeeded': 3, 'failed': 0, 'skipped': 0}
    self.assertCertificatesGenerated(task_input, expected_results)
    for student in students[:3]:
        self.assertIn(GeneratedCertificate.certificate_for_student(student, self.course.id).status, CertificateStatuses.PASSED_STATUSES)
    for student in students[3:]:
        self.assertIsNone(GeneratedCertificate.certificate_for_student(student, self.course.id))
