'Verify that certificates are regenerated for all eligible students enrolled in a course whose generated
certificate statuses lies in the list \'statuses_to_regenerate\' given in task_input.'

def test_certificate_regeneration_for_statuses_to_regenerate(self):

    students = self._create_students(10)
    for student in students[:2]:
        GeneratedCertificateFactory.create(user=student, course_id=self.course.id, status=CertificateStatuses.downloadable, mode='honor')
    for student in students[2:5]:
        GeneratedCertificateFactory.create(user=student, course_id=self.course.id, status=CertificateStatuses.error, mode='honor')
    for student in students[5:6]:
        GeneratedCertificateFactory.create(user=student, course_id=self.course.id, status=CertificateStatuses.deleted, mode='honor')
    for student in students[:7]:
        CertificateWhitelistFactory.create(user=student, course_id=self.course.id, whitelist=True)
    task_input = {'statuses_to_regenerate': [CertificateStatuses.downloadable, CertificateStatuses.error]}
    expected_results = {'action_name': 'certificates    generated', 'total': 10, 'attempted': 5, 'succeeded': 5, 'failed': 0, 'skipped': 5}
    self.assertCertificatesGenerated(task_input, expected_results)
