From ba1ddd324994b684c347d49635f21847cea87d8a Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Fri, 29 Nov 2024 16:53:36 +0530 Subject: [PATCH 01/12] FT-814:Add projection support for groups endpoint. Included Roles in model. Rectified the issue withe limit not working --- pyatlan/client/constants.py | 2 +- pyatlan/client/group.py | 19 +++++++++++-------- pyatlan/model/group.py | 7 +++++++ test.py | 19 +++++++++++++++++++ test_groups.py | 8 ++++++++ 5 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 test.py create mode 100644 test_groups.py diff --git a/pyatlan/client/constants.py b/pyatlan/client/constants.py index e1e2009b..7d3cb199 100644 --- a/pyatlan/client/constants.py +++ b/pyatlan/client/constants.py @@ -14,7 +14,7 @@ ) ROLE_API = "roles" -GROUP_API = "groups" +GROUP_API = "v2/groups" USER_API = "users" QUERY_API = "query" IMAGE_API = "images" diff --git a/pyatlan/client/group.py b/pyatlan/client/group.py index 17b154e4..ac945a04 100644 --- a/pyatlan/client/group.py +++ b/pyatlan/client/group.py @@ -98,9 +98,10 @@ def get( sort: Optional[str] = None, count: bool = True, offset: int = 0, + columns: Optional[List[str]] = None, ) -> GroupResponse: """ - Retrieves a GroupResponse object which contains a list of the groups defined in Atlan. + Retrieves a GroupResponse lobject which contains a list of the groups defined in Atlan. :param limit: maximum number of results to be returned :param post_filter: which groups to retrieve @@ -110,9 +111,7 @@ def get( :returns: a GroupResponse object which contains a list of groups that match the provided criteria :raises AtlanError: on any API communication issue """ - request = GroupRequest( - post_filter=post_filter, limit=limit, sort=sort, count=count, offset=offset - ) + request = GroupRequest(post_filter=post_filter,limit=limit,sort=sort,count=count,offset=offset,columns=columns) endpoint = GET_GROUPS.format_path_with_params() raw_json = self._client._call_api( api=endpoint, query_params=request.query_params @@ -134,17 +133,21 @@ def get_all( limit: int = 20, offset: int = 0, sort: Optional[str] = "name", + columns: Optional[List[str]] = None, ) -> List[AtlanGroup]: """ Retrieve all groups defined in Atlan. :param limit: maximum number of results to be returned :param offset: starting point for the list of groups when paging - :param sort: property by which to sort the results, by default : `name` + :param sort: property by which to sort the results, by default : name :returns: a list of all the groups in Atlan """ - response: GroupResponse = self.get(offset=offset, limit=limit, sort=sort) - return [group for group in response] + if response := self.get( + offset=offset, limit=limit, sort=sort, columns=columns + ): + return response.records + return None @validate_arguments def get_by_name( @@ -218,4 +221,4 @@ def remove_users(self, guid: str, user_ids: Optional[List[str]] = None) -> None: REMOVE_USERS_FROM_GROUP.format_path({"group_guid": guid}), request_obj=rfgr, exclude_unset=True, - ) + ) \ No newline at end of file diff --git a/pyatlan/model/group.py b/pyatlan/model/group.py index 3389e2ef..724dc58a 100644 --- a/pyatlan/model/group.py +++ b/pyatlan/model/group.py @@ -48,6 +48,7 @@ class Attributes(AtlanObject): attributes: Optional[AtlanGroup.Attributes] = Field( default=None, description="Detailed attributes of the group." ) + roles: Optional[List[str]] = Field(default=None, description="TBC") decentralized_roles: Optional[List[Any]] = Field(default=None, description="TBC") id: Optional[str] = Field( default=None, description="Unique identifier for the group (GUID)." @@ -192,6 +193,10 @@ class GroupRequest(AtlanObject): default=20, description="Maximum number of groups to return per page.", ) + columns: Optional[List[str]] = Field( + default=None, + description="List of specific fields to include in the response.", + ) @property def query_params(self) -> dict: @@ -203,6 +208,8 @@ def query_params(self) -> dict: qp["count"] = self.count qp["offset"] = self.offset qp["limit"] = self.limit + if self.columns: + qp["columns"] = self.columns return qp diff --git a/test.py b/test.py new file mode 100644 index 00000000..7f544a57 --- /dev/null +++ b/test.py @@ -0,0 +1,19 @@ +from pyatlan.client.atlan import AtlanClient + +client = AtlanClient() +groups = client.group.get_all(limit=1, offset=3, sort="-createdAt",columns=["roles","path"]) +groups1 = client.group.get_all(limit=10, offset=0, sort="-createdAt") +groups2 = client.group.get_all(limit=10, offset=2) +groups3 = client.group.get_all(limit=1) +groups4 = client.group.get_all() + +print("With Columns") +print(groups) +print("Wihout Columns") +print(groups1) +print("without sort") +print(groups2) +print("Without offset") +print(groups3) +print("empty") +print(groups4) \ No newline at end of file diff --git a/test_groups.py b/test_groups.py new file mode 100644 index 00000000..fabafab9 --- /dev/null +++ b/test_groups.py @@ -0,0 +1,8 @@ +from pyatlan.client.atlan import AtlanClient +import logging +logging. basicConfig (level=logging.DEBUG) # +client = AtlanClient() + +groups3 = client.group.get_all(limit=3) + +print(groups3) From 8b60e28dc266be0b37591aefd23f883f7d7c1c8e Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Fri, 29 Nov 2024 17:01:49 +0530 Subject: [PATCH 02/12] Delete test_groups.py --- test_groups.py | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 test_groups.py diff --git a/test_groups.py b/test_groups.py deleted file mode 100644 index fabafab9..00000000 --- a/test_groups.py +++ /dev/null @@ -1,8 +0,0 @@ -from pyatlan.client.atlan import AtlanClient -import logging -logging. basicConfig (level=logging.DEBUG) # -client = AtlanClient() - -groups3 = client.group.get_all(limit=3) - -print(groups3) From 1101af08ad1d580d8763873bde10da8b3a088655 Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Fri, 29 Nov 2024 17:01:58 +0530 Subject: [PATCH 03/12] Delete test.py --- test.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index 7f544a57..00000000 --- a/test.py +++ /dev/null @@ -1,19 +0,0 @@ -from pyatlan.client.atlan import AtlanClient - -client = AtlanClient() -groups = client.group.get_all(limit=1, offset=3, sort="-createdAt",columns=["roles","path"]) -groups1 = client.group.get_all(limit=10, offset=0, sort="-createdAt") -groups2 = client.group.get_all(limit=10, offset=2) -groups3 = client.group.get_all(limit=1) -groups4 = client.group.get_all() - -print("With Columns") -print(groups) -print("Wihout Columns") -print(groups1) -print("without sort") -print(groups2) -print("Without offset") -print(groups3) -print("empty") -print(groups4) \ No newline at end of file From 9cf23e5a2fadcc0da7c6910f5ed9845b02842704 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Fri, 29 Nov 2024 17:16:14 +0530 Subject: [PATCH 04/12] small changes --- pyatlan/client/group.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pyatlan/client/group.py b/pyatlan/client/group.py index ac945a04..eb5c792f 100644 --- a/pyatlan/client/group.py +++ b/pyatlan/client/group.py @@ -111,7 +111,14 @@ def get( :returns: a GroupResponse object which contains a list of groups that match the provided criteria :raises AtlanError: on any API communication issue """ - request = GroupRequest(post_filter=post_filter,limit=limit,sort=sort,count=count,offset=offset,columns=columns) + request = GroupRequest( + post_filter=post_filter, + limit=limit, + sort=sort, + count=count, + offset=offset, + columns=columns, + ) endpoint = GET_GROUPS.format_path_with_params() raw_json = self._client._call_api( api=endpoint, query_params=request.query_params @@ -143,11 +150,9 @@ def get_all( :param sort: property by which to sort the results, by default : name :returns: a list of all the groups in Atlan """ - if response := self.get( - offset=offset, limit=limit, sort=sort, columns=columns - ): - return response.records - return None + if response := self.get(offset=offset, limit=limit, sort=sort, columns=columns): + return response.records # type: ignore + return [] # type: ignore @validate_arguments def get_by_name( @@ -221,4 +226,4 @@ def remove_users(self, guid: str, user_ids: Optional[List[str]] = None) -> None: REMOVE_USERS_FROM_GROUP.format_path({"group_guid": guid}), request_obj=rfgr, exclude_unset=True, - ) \ No newline at end of file + ) From 9742620e0a22f3e2a441c40dcb623d64681cf084 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Sat, 30 Nov 2024 00:10:11 +0530 Subject: [PATCH 05/12] Added a new constant GROUP_API_V2 for v2 API support for columns projection --- pyatlan/client/constants.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyatlan/client/constants.py b/pyatlan/client/constants.py index 7d3cb199..ce43597f 100644 --- a/pyatlan/client/constants.py +++ b/pyatlan/client/constants.py @@ -14,7 +14,8 @@ ) ROLE_API = "roles" -GROUP_API = "v2/groups" +GROUP_API = "groups" +GROUP_API_V2 = "v2/groups" USER_API = "users" QUERY_API = "query" IMAGE_API = "images" @@ -25,7 +26,9 @@ GET_ROLES = API(ROLE_API, HTTPMethod.GET, HTTPStatus.OK, endpoint=EndPoint.HERACLES) # Group APIs -GET_GROUPS = API(GROUP_API, HTTPMethod.GET, HTTPStatus.OK, endpoint=EndPoint.HERACLES) +GET_GROUPS = API( + GROUP_API_V2, HTTPMethod.GET, HTTPStatus.OK, endpoint=EndPoint.HERACLES +) CREATE_GROUP = API( GROUP_API, HTTPMethod.POST, HTTPStatus.OK, endpoint=EndPoint.HERACLES ) From 49e2f910c2251802bf94fd93737d406410029db6 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Sat, 30 Nov 2024 00:44:56 +0530 Subject: [PATCH 06/12] Made a small change for get_all() output --- pyatlan/client/group.py | 7 ++++--- testing.py | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 testing.py diff --git a/pyatlan/client/group.py b/pyatlan/client/group.py index eb5c792f..1d5d2b92 100644 --- a/pyatlan/client/group.py +++ b/pyatlan/client/group.py @@ -150,9 +150,10 @@ def get_all( :param sort: property by which to sort the results, by default : name :returns: a list of all the groups in Atlan """ - if response := self.get(offset=offset, limit=limit, sort=sort, columns=columns): - return response.records # type: ignore - return [] # type: ignore + response: GroupResponse = self.get( + offset=offset, limit=limit, sort=sort, columns=columns + ) + return [group for group in response] @validate_arguments def get_by_name( diff --git a/testing.py b/testing.py new file mode 100644 index 00000000..fc44df4b --- /dev/null +++ b/testing.py @@ -0,0 +1,7 @@ +from pyatlan.client.atlan import AtlanClient + +client = AtlanClient() + +groups = client.group.get_all(limit=1) + +print(groups) From c9db24b1106c2690de88adfc2fe80e84b603de0a Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Sat, 30 Nov 2024 00:47:03 +0530 Subject: [PATCH 07/12] Delete testing.py --- testing.py | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 testing.py diff --git a/testing.py b/testing.py deleted file mode 100644 index fc44df4b..00000000 --- a/testing.py +++ /dev/null @@ -1,7 +0,0 @@ -from pyatlan.client.atlan import AtlanClient - -client = AtlanClient() - -groups = client.group.get_all(limit=1) - -print(groups) From a5fbe77b4c22fdef97c4b48f8a5c565418f5e5c8 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Sun, 1 Dec 2024 01:15:53 +0530 Subject: [PATCH 08/12] Add the unit tests and integration tests. Changed Count from True to False in get(). Changed the get_all() output. Corrected a few doc strings and added new ones as well --- pyatlan/client/group.py | 13 +++--- tests/integration/admin_test.py | 57 ++++++++++++++++++++++++- tests/unit/test_client.py | 74 +++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 7 deletions(-) diff --git a/pyatlan/client/group.py b/pyatlan/client/group.py index 1d5d2b92..1b0d0d11 100644 --- a/pyatlan/client/group.py +++ b/pyatlan/client/group.py @@ -96,18 +96,19 @@ def get( limit: Optional[int] = 20, post_filter: Optional[str] = None, sort: Optional[str] = None, - count: bool = True, + count: bool = False, offset: int = 0, columns: Optional[List[str]] = None, ) -> GroupResponse: """ - Retrieves a GroupResponse lobject which contains a list of the groups defined in Atlan. + Retrieves a GroupResponse object which contains a list of the groups defined in Atlan. :param limit: maximum number of results to be returned :param post_filter: which groups to retrieve :param sort: property by which to sort the results :param count: whether to return the total number of records (True) or not (False) :param offset: starting point for results to return, for paging + :param columns: provides columns projection support for groups endpoint :returns: a GroupResponse object which contains a list of groups that match the provided criteria :raises AtlanError: on any API communication issue """ @@ -148,12 +149,12 @@ def get_all( :param limit: maximum number of results to be returned :param offset: starting point for the list of groups when paging :param sort: property by which to sort the results, by default : name + :param columns: provides columns projection support for groups endpoint :returns: a list of all the groups in Atlan """ - response: GroupResponse = self.get( - offset=offset, limit=limit, sort=sort, columns=columns - ) - return [group for group in response] + if response := self.get(offset=offset, limit=limit, sort=sort, columns=columns): + return response.records # type: ignore + return None # type: ignore @validate_arguments def get_by_name( diff --git a/tests/integration/admin_test.py b/tests/integration/admin_test.py index 196d7886..8f83e6ee 100644 --- a/tests/integration/admin_test.py +++ b/tests/integration/admin_test.py @@ -82,7 +82,7 @@ def test_retrieve_all_groups(client: AtlanClient, group: CreateGroupResponse): def test_group_get_pagination(client: AtlanClient, group: CreateGroupResponse): - response = client.group.get(limit=1) + response = client.group.get(limit=1, count=True) assert response assert response.total_record is not None @@ -295,3 +295,58 @@ def test_retrieve_admin_logs( if count >= 1000: break assert count > 0 + + +def test_get_all_with_limit(client: AtlanClient, group: CreateGroupResponse): + limit = 2 + groups = client.group.get_all(limit=limit) + assert groups + assert len(groups) == limit + + for group1 in groups: + assert group1.id + assert group1.name + assert group1.path is not None + + +def test_get_all_with_columns(client: AtlanClient, group: CreateGroupResponse): + columns = ["path"] + groups = client.group.get_all(columns=columns) + + assert groups + assert len(groups) >= 1 + + for group1 in groups: + assert group1.name + assert group1.path is not None + assert group1.attributes is None + assert group1.roles is None + + +def test_get_all_with_sorting(client: AtlanClient, group: CreateGroupResponse): + groups = client.group.get_all(sort="name") + + assert groups + assert len(groups) >= 1 + + sorted_names = [group.name for group in groups if group.name is not None] + assert sorted_names == sorted(sorted_names) + + +def test_get_all_with_everything(client: AtlanClient, group: CreateGroupResponse): + limit = 2 + columns = ["path", "attributes"] + sort = "name" + + groups = client.group.get_all(limit=limit, columns=columns, sort=sort) + + assert groups + assert len(groups) == limit + sorted_names = [group.name for group in groups if group.name is not None] + assert sorted_names == sorted(sorted_names) + + for group1 in groups: + assert group1.name + assert group1.path is not None + assert group1.roles is None + assert group1.attributes is not None diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 42f3458c..4914042f 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -136,6 +136,11 @@ def client(): return AtlanClient() +@pytest.fixture +def group_client(mock_api_caller): + return GroupClient(client=mock_api_caller) + + @pytest.fixture def mock_asset_client(): return Mock(AssetClient) @@ -2219,3 +2224,72 @@ def test_atlan_client_headers(client: AtlanClient): "x-atlan-client-origin": "product_sdk", } assert expected == client._session.headers + + +def test_get_all_pagation(group_client, mock_api_caller): + mock_page_1 = [ + {"id": "1", "alias": "Group3"}, + {"id": "2", "alias": "Group4"}, + ] + mock_api_caller._call_api.side_effect = [ + {"records": mock_page_1}, + ] + + groups = group_client.get_all(limit=2) + + assert len(groups) == 2 + assert groups[0].id == "1" + assert groups[1].id == "2" + assert mock_api_caller._call_api.call_count == 1 + + +def test_get_all_empty_response_with_raw_records(group_client, mock_api_caller): + mock_api_caller.reset_mock() + mock_page_1 = [] + mock_api_caller._call_api.side_effect = [ + {"records": mock_page_1}, + ] + + groups = group_client.get_all() + assert len(groups) == 0 + + +def test_get_all_with_columns(group_client, mock_api_caller): + mock_api_caller.reset_mock() + mock_page_1 = [ + {"id": "1", "alias": "Group1"}, + {"id": "2", "alias": "Group2"}, + ] + mock_api_caller._call_api.side_effect = [ + {"records": mock_page_1}, + ] + + columns = ["alias"] + groups = group_client.get_all(limit=10, columns=columns) + + assert len(groups) == 2 + assert groups[0].id == "1" + assert groups[0].alias == "Group1" + mock_api_caller._call_api.assert_called_once() + query_params = mock_api_caller._call_api.call_args.kwargs["query_params"] + assert query_params["columns"] == columns + + +def test_get_all_sorting(group_client, mock_api_caller): + mock_api_caller.reset_mock() + mock_page_1 = [ + {"id": "1", "alias": "Group1"}, + {"id": "2", "alias": "Group2"}, + ] + mock_api_caller._call_api.side_effect = [ + {"records": mock_page_1}, + ] + + groups = group_client.get_all(limit=10, sort="alias") + + assert len(groups) == 2 + assert groups[0].id == "1" + assert groups[0].alias == "Group1" + mock_api_caller._call_api.assert_called_once() + query_params = mock_api_caller._call_api.call_args.kwargs["query_params"] + assert query_params["sort"] == "alias" From a540bc06ea6744afd8ea5bb09303976d9890dd8e Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Mon, 2 Dec 2024 16:11:41 +0530 Subject: [PATCH 09/12] Changed the count = False back to True(as it was before) --- pyatlan/client/group.py | 2 +- testing.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 testing.py diff --git a/pyatlan/client/group.py b/pyatlan/client/group.py index 1b0d0d11..5fafcb2a 100644 --- a/pyatlan/client/group.py +++ b/pyatlan/client/group.py @@ -96,7 +96,7 @@ def get( limit: Optional[int] = 20, post_filter: Optional[str] = None, sort: Optional[str] = None, - count: bool = False, + count: bool = True, offset: int = 0, columns: Optional[List[str]] = None, ) -> GroupResponse: diff --git a/testing.py b/testing.py new file mode 100644 index 00000000..c3394d7e --- /dev/null +++ b/testing.py @@ -0,0 +1,32 @@ +from pyatlan.client.atlan import AtlanClient +from pyatlan.model.assets import AtlasGlossaryTerm, Readme +from pyatlan.model.fluent_search import CompoundQuery, FluentSearch + +client = AtlanClient() + +TERM_QN = "94lsTxZtqVnQBhWOzCSli@6PGearcKbfun3CBSmDLYy" + +response = ( + FluentSearch() + .select() + .where(CompoundQuery.asset_type(AtlasGlossaryTerm)) + .where(AtlasGlossaryTerm.QUALIFIED_NAME.eq(TERM_QN)) + .include_on_results(AtlasGlossaryTerm.README) + .include_on_relations(Readme.DESCRIPTION) + .execute(client=client) +) + +if first := response.current_page(): + current_content = first[0].readme.description + updated_content = "\n

Added new information to the Readme.

" + updated_readme = Readme.creator( + asset=first[0], + content=updated_content + ) + save_response = client.asset.save(updated_readme) + + + + + + From d3fbf00ae18b13393fd0dd7bce89d6093edea4eb Mon Sep 17 00:00:00 2001 From: Vaibhav Chopra Date: Mon, 2 Dec 2024 16:18:15 +0530 Subject: [PATCH 10/12] Delete testing.py Added by mistake --- testing.py | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 testing.py diff --git a/testing.py b/testing.py deleted file mode 100644 index c3394d7e..00000000 --- a/testing.py +++ /dev/null @@ -1,32 +0,0 @@ -from pyatlan.client.atlan import AtlanClient -from pyatlan.model.assets import AtlasGlossaryTerm, Readme -from pyatlan.model.fluent_search import CompoundQuery, FluentSearch - -client = AtlanClient() - -TERM_QN = "94lsTxZtqVnQBhWOzCSli@6PGearcKbfun3CBSmDLYy" - -response = ( - FluentSearch() - .select() - .where(CompoundQuery.asset_type(AtlasGlossaryTerm)) - .where(AtlasGlossaryTerm.QUALIFIED_NAME.eq(TERM_QN)) - .include_on_results(AtlasGlossaryTerm.README) - .include_on_relations(Readme.DESCRIPTION) - .execute(client=client) -) - -if first := response.current_page(): - current_content = first[0].readme.description - updated_content = "\n

Added new information to the Readme.

" - updated_readme = Readme.creator( - asset=first[0], - content=updated_content - ) - save_response = client.asset.save(updated_readme) - - - - - - From 0fedd4c4001ed7d2cf5fb9249756e216920e5340 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Mon, 2 Dec 2024 18:49:46 +0530 Subject: [PATCH 11/12] Changed the position of the mock_api_caller.reset_mock() to the end of each test function as suggested. --- tests/unit/test_client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 4914042f..f0905150 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -2241,10 +2241,10 @@ def test_get_all_pagation(group_client, mock_api_caller): assert groups[0].id == "1" assert groups[1].id == "2" assert mock_api_caller._call_api.call_count == 1 + mock_api_caller.reset_mock() def test_get_all_empty_response_with_raw_records(group_client, mock_api_caller): - mock_api_caller.reset_mock() mock_page_1 = [] mock_api_caller._call_api.side_effect = [ {"records": mock_page_1}, @@ -2252,10 +2252,10 @@ def test_get_all_empty_response_with_raw_records(group_client, mock_api_caller): groups = group_client.get_all() assert len(groups) == 0 + mock_api_caller.reset_mock() def test_get_all_with_columns(group_client, mock_api_caller): - mock_api_caller.reset_mock() mock_page_1 = [ {"id": "1", "alias": "Group1"}, {"id": "2", "alias": "Group2"}, @@ -2273,10 +2273,9 @@ def test_get_all_with_columns(group_client, mock_api_caller): mock_api_caller._call_api.assert_called_once() query_params = mock_api_caller._call_api.call_args.kwargs["query_params"] assert query_params["columns"] == columns - + mock_api_caller.reset_mock() def test_get_all_sorting(group_client, mock_api_caller): - mock_api_caller.reset_mock() mock_page_1 = [ {"id": "1", "alias": "Group1"}, {"id": "2", "alias": "Group2"}, @@ -2293,3 +2292,4 @@ def test_get_all_sorting(group_client, mock_api_caller): mock_api_caller._call_api.assert_called_once() query_params = mock_api_caller._call_api.call_args.kwargs["query_params"] assert query_params["sort"] == "alias" + mock_api_caller.reset_mock() From 04e853ccf1c768b3da1bedab619661a6e38d08e9 Mon Sep 17 00:00:00 2001 From: vaibhavatlan Date: Mon, 2 Dec 2024 18:53:07 +0530 Subject: [PATCH 12/12] Pyformater and qachecks re-run --- tests/unit/test_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index f0905150..8e537c42 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -2275,6 +2275,7 @@ def test_get_all_with_columns(group_client, mock_api_caller): assert query_params["columns"] == columns mock_api_caller.reset_mock() + def test_get_all_sorting(group_client, mock_api_caller): mock_page_1 = [ {"id": "1", "alias": "Group1"},