'Test certificates exception addition api endpoint returns failure when called with
username/email that is not enrolled in the given course.'

def test_certificate_exception_user_not_enrolled_error(self):

    CourseEnrollment.unenroll(self.user, self.course.id)
    response = self.client.post(self.url, data=json.dumps(self.certificate_exception), content_type='application/json')
    self.assertEqual(response.status_code, 400)
    res_json = json.loads(response.content)
    self.assertFalse(res_json['success'])
    self.assertEqual(res_json['message'], '{user}    is    not    enrolled    in    this    course.    Please    check    your    spelling    and    retry.'.format(user=self.certificate_exception['user_name']))
