'Call the regeneration end-point and return the response.'

def _regenerate(self, course_key=None, username=None):

    url = reverse('certificates:regenerate_certificate_for_user')
    params = {}
    if (course_key is not None):
        params['course_key'] = course_key
    if (username is not None):
        params['username'] = username
    return self.client.post(url, params)
