'Test certificate regeneration errors out when accessed with either empty list of \'certificate_statuses\' or
the \'certificate_statuses\' that are not present in GeneratedCertificate table.'

def test_certificate_regeneration_error(self):

    dummy_course = CourseFactory.create()
    GeneratedCertificateFactory.create(user=self.user, course_id=dummy_course.id, status=CertificateStatuses.generating, 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)
    self.assertEqual(response.status_code, 400)
    res_json = json.loads(response.content)
    self.assertEqual(res_json['message'], u'Please    select    one    or    more    certificate    statuses    that    require    certificate    regeneration.')
    url = reverse('start_certificate_regeneration', kwargs={'course_id': unicode(self.course.id)})
    response = self.client.post(url, data={'certificate_statuses': [CertificateStatuses.generating]})
    self.assertEqual(response.status_code, 400)
    res_json = json.loads(response.content)
    self.assertEqual(res_json['message'], u'Please    select    certificate    statuses    from    the    list    only.')
