Exemple #1
0
def test_revoke_role():
    role_data = get_role_data()
    role_data['roles'] = []
    old_roles = rolelib.get_roles_in_context(role_data['user_id'], role_data['context'])
    rolelib.new_roles(**role_data)
    new_roles = rolelib.get_roles_in_context(role_data['user_id'], role_data['context'])
    assert set(new_roles).intersection(old_roles) == set()
    env.context.pgcursor.connection.commit()
Exemple #2
0
def test_reassign_role():
    role_data = get_role_data()
    rolelib.new_roles(**role_data)
    assert set(role_data['roles']).issubset(rolelib.get_roles_in_context(role_data['user_id'], role_data['context'])) == True
    env.context.pgcursor.connection.commit()