コード例 #1
0
def test_valid_flockr_owner_changing_to_same_permission(flockr_owner):
    owner = flockr_owner

    admin_userpermission_change(owner['token'], owner['u_id'], 1)

    # Make sure the owner is still an owner with no errors raised
    assert is_flockr_owner(owner['token'], owner['u_id'])
コード例 #2
0
def test_valid_flockr_owner_target_themselves(flockr_owner):
    owner = flockr_owner

    admin_userpermission_change(owner['token'], owner['u_id'], 2)

    # Make sure the owner is now a member
    assert not is_flockr_owner(owner['token'], owner['u_id'])
コード例 #3
0
def test_invalid_flockr_owner(flockr_owner, register_user):
    flockr_owner
    user = register_user

    # Expect AccessError when authorised user is not an owner
    with pytest.raises(AccessError):
        admin_userpermission_change(user['token'], user['u_id'], 1)
コード例 #4
0
def test_invalid_permission_id(flockr_owner, register_user):
    owner = flockr_owner
    register_user

    # Expect InputError when permission_id is not 1 or 2
    with pytest.raises(InputError):
        admin_userpermission_change(owner['token'], 1, 3)
コード例 #5
0
def test_valid_flockr_owner_making_flockr_owner(flockr_owner, register_user):
    owner = flockr_owner
    user = register_user

    admin_userpermission_change(owner['token'], user['u_id'], 1)

    # Make sure the user is now a Flockr owner
    assert is_flockr_owner(user['token'], user['u_id'])
コード例 #6
0
def admin_userpermission_change_flask():
    payload = request.get_json()

    token = payload['token']
    u_id = payload['u_id']
    permission_id = payload['permission_id']

    return dumps(o.admin_userpermission_change(token, u_id, permission_id))
コード例 #7
0
def test_invalid_u_id(flockr_owner):
    owner = flockr_owner

    # Expect InputError when user does not exist
    with pytest.raises(InputError):
        admin_userpermission_change(owner['token'], 'not_valid_u_id', 1)
コード例 #8
0
def test_invalid_token():
    with pytest.raises(AccessError):
        admin_userpermission_change(token_hash(-1), 0, 2)