'Test certificates exception addition api endpoint returns failure when called with
username/email that already exists in \'CertificateWhitelist\' table.'

def test_certificate_exception_duplicate_user_error(self):

    response = self.client.post(self.url, data=json.dumps(self.certificate_exception_in_db), content_type='application/json')
    self.assertEqual(response.status_code, 400)
    res_json = json.loads(response.content)
    self.assertFalse(res_json['success'])
    user = self.certificate_exception_in_db['user_name']
    self.assertEqual(res_json['message'], u'Student    (username/email={user_name})    already    in    certificate    exception    list.'.format(user_name=user))
