def test_api_user_create_bad(data, message, status_code):
    """ Test create role with bad data
    """
    user = helper.api.user.current
    url = helper.api.role.create.url
    response = requests.post(url=url,
                             headers={"Authorization": user["token"]},
                             json=data)
    assert_api_error(response, message, status_code)
def test_api_propose_role_member_required_fields():
    """ Test proposing adding a member to a role with missing fields
    """
    role, _ = helper.api.role.current
    user = helper.api.user.create.current
    url = helper.api.role.member.propose.url(role_id=role["id"])
    data = {}
    response = requests.post(url=url,
                             headers={"Authorization": user["token"]},
                             json=data)
    assert_api_error(response, "Bad Request: id field is required", 400)
예제 #3
0
def test_api_user_login_bad_password():
    """ Test user login with the wrong password
    """
    url = helper.api.user.create.auth_url
    user = helper.api.user.current
    data = {"id": user["username"], "password": "******" + user["password"]}
    response = requests.post(url=url, headers=None, json=data)
    assert assert_api_error(response, "Unauthorized: Incorrect password", 401)
예제 #4
0
def test_api_user_signup_bad(data, message, status_code):
    """ Test user signup with bad data
    """
    url = helper.api.user.create.url
    response = requests.post(url=url, headers=None, json=data)
    assert assert_api_error(response, message, status_code)
예제 #5
0
def test_api_user_login_bad_data(data, message, status_code):
    """ Test user login with bad data
    """
    url = helper.api.user.create.auth_url
    response = requests.post(url=url, headers=None, json=data)
    assert assert_api_error(response, message, status_code)