Exemplo n.º 1
0
async def test_fetch_roles_managed(AuthForRoles, make_role):
    "When a role is present and managed, it is included"
    resources = Resources([], [".*"])
    api_role = make_role()
    AuthForRoles.roles.append(api_role)
    await fetch_roles(resources)
    assert list(resources) == [Role.from_api(api_role)]
Exemplo n.º 2
0
async def test_fetch_roles_unmanaged(AuthForRoles, make_role):
    "When a role is present and unmanaged, it is not included"
    resources = Resources([], ["Role=managed*"])
    api_role1 = make_role(roleId="managed-role")
    api_role2 = make_role(roleId="un-managed-role")
    AuthForRoles.roles.extend([api_role1, api_role2])
    await fetch_roles(resources)
    assert list(resources) == [Role.from_api(api_role1)]