Skip to content

Commit 86d8e1d

Browse files
committed
Fix integration tests
1 parent a4fa7e5 commit 86d8e1d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/integration/test_infrahub_client.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from infrahub_sdk.exceptions import BranchNotFoundError, URLNotFoundError
99
from infrahub_sdk.node import InfrahubNode
1010
from infrahub_sdk.schema import ProfileSchemaAPI
11-
from infrahub_sdk.task.models import Task, TaskFilter, TaskState
11+
from infrahub_sdk.task.models import Task, TaskFilter, TaskLog, TaskState
1212
from infrahub_sdk.testing.docker import TestInfrahubDockerClient
1313
from infrahub_sdk.testing.schemas.animal import TESTING_ANIMAL, TESTING_CAT, TESTING_DOG, TESTING_PERSON, SchemaAnimal
1414

@@ -199,11 +199,14 @@ async def test_task_query(self, client: InfrahubClient, base_dataset, set_pagina
199199
assert task
200200
assert isinstance(task, Task)
201201

202-
# Query Task with logs
203-
task = await client.task.get(id=tasks[0].id, include_logs=True)
204-
assert task
205-
assert isinstance(task, Task)
206-
assert task.logs
202+
# Query Tasks with logs
203+
tasks = await client.task.filter(filter=TaskFilter(state=[TaskState.COMPLETED]), include_logs=True)
204+
all_logs = [log for task in tasks for log in task.logs]
205+
assert all_logs
206+
assert isinstance(all_logs[0], TaskLog)
207+
assert all_logs[0].message
208+
assert all_logs[0].timestamp
209+
assert all_logs[0].severity
207210

208211
# async def test_get_generic_filter_source(self, client: InfrahubClient, base_dataset):
209212
# admin = await client.get(kind="CoreAccount", name__value="admin")

0 commit comments

Comments
 (0)