Skip to content

Commit b6aafa1

Browse files
vaibhavatlanAryamanz29
authored andcommitted
Fixed the test cases
1 parent c6bfe3f commit b6aafa1

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

tests/integration/admin_test.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ def test_create_group(client: AtlanClient, group: CreateGroupResponse):
7272

7373
def test_retrieve_all_groups(client: AtlanClient, group: CreateGroupResponse):
7474
global _default_group_count
75-
groups = client.group.get_all() # type: ignore
76-
assert groups
77-
assert len(groups) >= 1 # type: ignore
78-
for group1 in groups:
75+
groups = client.group.get_all()
76+
assert groups.records
77+
assert len(groups.records) >= 1
78+
for group1 in groups.records:
7979
if group1.is_default():
8080
_default_group_count += 1
8181

@@ -299,10 +299,10 @@ def test_retrieve_admin_logs(
299299
def test_get_all_with_limit(client: AtlanClient, group: CreateGroupResponse):
300300
limit = 2
301301
groups = client.group.get_all(limit=limit)
302-
assert groups
303-
assert len(groups) == limit # type: ignore
302+
assert groups.records
303+
assert len(groups.records) == limit
304304

305-
for group1 in groups:
305+
for group1 in groups.records:
306306
assert group1.id
307307
assert group1.name
308308
assert group1.path is not None
@@ -313,9 +313,10 @@ def test_get_all_with_columns(client: AtlanClient, group: CreateGroupResponse):
313313
groups = client.group.get_all(columns=columns)
314314

315315
assert groups
316-
assert len(groups) >= 1 # type: ignore
316+
assert groups.records
317+
assert len(groups.records) >= 1
317318

318-
for group1 in groups:
319+
for group1 in groups.records:
319320
assert group1.name
320321
assert group1.path is not None
321322
assert group1.attributes is None
@@ -326,9 +327,9 @@ def test_get_all_with_sorting(client: AtlanClient, group: CreateGroupResponse):
326327
groups = client.group.get_all(sort="name")
327328

328329
assert groups
329-
assert len(groups) >= 1 # type: ignore
330+
assert len(groups.records) >= 1 # type: ignore
330331

331-
sorted_names = [group.name for group in groups if group.name is not None]
332+
sorted_names = [group.name for group in groups.records if group.name is not None] # type: ignore
332333
assert sorted_names == sorted(sorted_names)
333334

334335

@@ -340,11 +341,11 @@ def test_get_all_with_everything(client: AtlanClient, group: CreateGroupResponse
340341
groups = client.group.get_all(limit=limit, columns=columns, sort=sort)
341342

342343
assert groups
343-
assert len(groups) == limit # type: ignore
344-
sorted_names = [group.name for group in groups if group.name is not None]
344+
assert len(groups.records) == limit # type: ignore
345+
sorted_names = [group.name for group in groups.records if group.name is not None] # type: ignore
345346
assert sorted_names == sorted(sorted_names)
346347

347-
for group1 in groups:
348+
for group1 in groups.records: # type: ignore
348349
assert group1.name
349350
assert group1.path is not None
350351
assert group1.roles is None

tests/unit/test_client.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,10 +2563,9 @@ def test_get_all_pagation(group_client, mock_api_caller):
25632563
]
25642564

25652565
groups = group_client.get_all(limit=2)
2566-
2567-
assert len(groups) == 2
2568-
assert groups[0].id == "1"
2569-
assert groups[1].id == "2"
2566+
assert len(groups.records) == 2
2567+
assert groups.records[0].id == "1"
2568+
assert groups.records[1].id == "2"
25702569
assert mock_api_caller._call_api.call_count == 1
25712570
mock_api_caller.reset_mock()
25722571

@@ -2578,7 +2577,7 @@ def test_get_all_empty_response_with_raw_records(group_client, mock_api_caller):
25782577
]
25792578

25802579
groups = group_client.get_all()
2581-
assert len(groups) == 0
2580+
assert len(groups.records) == 0
25822581
mock_api_caller.reset_mock()
25832582

25842583

@@ -2594,9 +2593,9 @@ def test_get_all_with_columns(group_client, mock_api_caller):
25942593
columns = ["alias"]
25952594
groups = group_client.get_all(limit=10, columns=columns)
25962595

2597-
assert len(groups) == 2
2598-
assert groups[0].id == "1"
2599-
assert groups[0].alias == "Group1"
2596+
assert len(groups.records) == 2
2597+
assert groups.records[0].id == "1"
2598+
assert groups.records[0].alias == "Group1"
26002599
mock_api_caller._call_api.assert_called_once()
26012600
query_params = mock_api_caller._call_api.call_args.kwargs["query_params"]
26022601
assert query_params["columns"] == columns
@@ -2614,9 +2613,9 @@ def test_get_all_sorting(group_client, mock_api_caller):
26142613

26152614
groups = group_client.get_all(limit=10, sort="alias")
26162615

2617-
assert len(groups) == 2
2618-
assert groups[0].id == "1"
2619-
assert groups[0].alias == "Group1"
2616+
assert len(groups.records) == 2
2617+
assert groups.records[0].id == "1"
2618+
assert groups.records[0].alias == "Group1"
26202619
mock_api_caller._call_api.assert_called_once()
26212620
query_params = mock_api_caller._call_api.call_args.kwargs["query_params"]
26222621
assert query_params["sort"] == "alias"

0 commit comments

Comments
 (0)