'Test certificate regeneration is successful when accessed with \'certificate_statuses\'
present in GeneratedCertificate table.'

def test_certificate_regeneration_success(self):

    GeneratedCertificateFactory.create(user=self.user, course_id=self.course.id, status=CertificateStatuses.downloadable, mode='honor')
    self.client.login(username=self.global_staff.username, password='test')
    url = reverse('start_certificate_regeneration', kwargs={'course_id': unicode(self.course.id)})
    response = self.client.post(url, data={'certificate_statuses': [CertificateStatuses.downloadable]})
    self.assertEqual(response.status_code, 200)
    res_json = json.loads(response.content)
    self.assertTrue(res_json['success'])
    self.assertEqual(res_json['message'], u'Certificate    regeneration    task    has    been    started.    You    can    view    the    status    of    the    generation    task    in    the    "Pending    Tasks"    section.')
