Skip to content

Commit fcdf964

Browse files
committed
more tests
1 parent 202a6a3 commit fcdf964

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

tests/unit/sdk/test_client.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,20 +241,22 @@ async def test_method_get_by_id(httpx_mock: HTTPXMock, clients, mock_schema_quer
241241
)
242242

243243
if client_type == "standard":
244-
repo = await clients.standard.get(kind="CoreRepository", id=response_id)
244+
repo = await clients.standard.get(kind="CoreRepository", id=response_id, populate_store=False)
245245
assert isinstance(repo, InfrahubNode)
246246
with pytest.raises(NodeNotFoundError):
247247
assert clients.standard.store.get(key=response_id)
248248

249-
repo = await clients.standard.get(kind="CoreRepository", id=response_id, populate_store=True)
249+
repo = await clients.standard.get(kind="CoreRepository", id=response_id)
250+
assert isinstance(repo, InfrahubNode)
250251
assert clients.standard.store.get(key=response_id)
251252
else:
252-
repo = clients.sync.get(kind="CoreRepository", id=response_id)
253+
repo = clients.sync.get(kind="CoreRepository", id=response_id, populate_store=False)
253254
assert isinstance(repo, InfrahubNodeSync)
254255
with pytest.raises(NodeNotFoundError):
255256
assert clients.sync.store.get(key=response_id)
256257

257-
repo = clients.sync.get(kind="CoreRepository", id=response_id, populate_store=True)
258+
repo = clients.sync.get(kind="CoreRepository", id=response_id)
259+
assert isinstance(repo, InfrahubNodeSync)
258260
assert clients.sync.store.get(key=response_id)
259261

260262

@@ -287,20 +289,22 @@ async def test_method_get_by_hfid(httpx_mock: HTTPXMock, clients, mock_schema_qu
287289
)
288290

289291
if client_type == "standard":
290-
repo = await clients.standard.get(kind="CoreRepository", hfid=["infrahub-demo-core"])
292+
repo = await clients.standard.get(kind="CoreRepository", hfid=["infrahub-demo-core"], populate_store=False)
291293
assert isinstance(repo, InfrahubNode)
292294
with pytest.raises(NodeNotFoundError):
293295
assert clients.standard.store.get(key=response_id)
294296

295-
repo = await clients.standard.get(kind="CoreRepository", hfid=["infrahub-demo-core"], populate_store=True)
297+
repo = await clients.standard.get(kind="CoreRepository", hfid=["infrahub-demo-core"])
298+
assert isinstance(repo, InfrahubNode)
296299
assert clients.standard.store.get(key=response_id)
297300
else:
298-
repo = clients.sync.get(kind="CoreRepository", hfid=["infrahub-demo-core"])
301+
repo = clients.sync.get(kind="CoreRepository", hfid=["infrahub-demo-core"], populate_store=False)
299302
assert isinstance(repo, InfrahubNodeSync)
300303
with pytest.raises(NodeNotFoundError):
301304
assert clients.sync.store.get(key="infrahub-demo-core")
302305

303-
repo = clients.sync.get(kind="CoreRepository", hfid=["infrahub-demo-core"], populate_store=True)
306+
repo = clients.sync.get(kind="CoreRepository", hfid=["infrahub-demo-core"])
307+
assert isinstance(repo, InfrahubNodeSync)
304308
assert clients.sync.store.get(key=response_id)
305309

306310

@@ -332,20 +336,20 @@ async def test_method_get_by_default_filter(httpx_mock: HTTPXMock, clients, mock
332336
)
333337

334338
if client_type == "standard":
335-
repo = await clients.standard.get(kind="CoreRepository", id="infrahub-demo-core")
339+
repo = await clients.standard.get(kind="CoreRepository", id="infrahub-demo-core", populate_store=False)
336340
assert isinstance(repo, InfrahubNode)
337341
with pytest.raises(NodeNotFoundError):
338342
assert clients.standard.store.get(key=response_id)
339343

340-
repo = await clients.standard.get(kind="CoreRepository", id="infrahub-demo-core", populate_store=True)
344+
repo = await clients.standard.get(kind="CoreRepository", id="infrahub-demo-core")
341345
assert clients.standard.store.get(key=response_id)
342346
else:
343-
repo = clients.sync.get(kind="CoreRepository", id="infrahub-demo-core")
347+
repo = clients.sync.get(kind="CoreRepository", id="infrahub-demo-core", populate_store=False)
344348
assert isinstance(repo, InfrahubNodeSync)
345349
with pytest.raises(NodeNotFoundError):
346350
assert clients.sync.store.get(key="infrahub-demo-core")
347351

348-
repo = clients.sync.get(kind="CoreRepository", id="infrahub-demo-core", populate_store=True)
352+
repo = clients.sync.get(kind="CoreRepository", id="infrahub-demo-core")
349353
assert clients.sync.store.get(key=response_id)
350354

351355

0 commit comments

Comments
 (0)