async def test_fetch_clients_managed(AuthForClients, make_client): "When a client is present and managed, it is included" resources = Resources([], [".*"]) api_client = make_client() AuthForClients.clients.append(api_client) await fetch_clients(resources) assert list(resources) == [Client.from_api(api_client)]
async def test_fetch_clients_unmanaged(AuthForClients, make_client): "When a client is present and unmanaged, it is not included" resources = Resources([], ["Client=managed*"]) api_client1 = make_client(clientId="managed-client") api_client2 = make_client(clientId="un-managed-client") AuthForClients.clients.extend([api_client1, api_client2]) await fetch_clients(resources) assert list(resources) == [Client.from_api(api_client1)]