def add_user(username,
             deployment_name,
             token_manager=None,
             app_url=defaults.APP_URL):
    """
    add user to deployment

    """
    deployment_id = get_deployment_id(deployment_name,
                                      token_manager=token_manager,
                                      app_url=app_url)

    account_id = accounts.get_account_id(username,
                                         token_manager=token_manager,
                                         app_url=app_url)

    headers = token_manager.get_access_token_headers()
    deployment_url = environment.get_deployment_url(app_url=app_url)
    response = requests.put('%s/api/v1/deployments/%s/accounts/%s' %
                            (deployment_url, deployment_id, account_id),
                            headers=headers)

    if response.status_code == 204:
        return response.text
    else:
        raise JutException('Error %s: %s' % (response.status_code, response.text))
add user to deployment