예제 #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)]
예제 #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)]