'Test error message if user is not enrolled in the course.'

def test_user_not_enrolled_error(self):

    self.certificate_invalidation_data.update({'user': self.not_enrolled_student.username})
    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'{user}    is    not    enrolled    in    this    course.    Please    check    your    spelling    and    retry.'.format(user=self.not_enrolled_student.username))
