'Test error message if certificate for the student is already invalid.'

def test_certificate_already_invalid_error(self):

    self.generated_certificate.invalidate()
    response = self.client.post(self.url, data=json.dumps(self.certificate_invalidation_data), content_type='application/json')
    self.assertEqual(response.status_code, 400)
    res_json = json.loads(response.content)
    self.assertEqual(res_json['message'], u'Certificate    for    student    {user}    is    already    invalid,    kindly    verify    that    certificate    was    generated    for    this    student    and    then    proceed.'.format(user=self.enrolled_user_1.username))
