From b30571eef2492cdd0e3561aedb57d19d48df4de1 Mon Sep 17 00:00:00 2001 From: Tanmay Rustagi Date: Thu, 12 Dec 2024 14:41:12 +0100 Subject: [PATCH] - --- tests/test_iam.py | 48 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/tests/test_iam.py b/tests/test_iam.py index e547fbd7..81f83c51 100644 --- a/tests/test_iam.py +++ b/tests/test_iam.py @@ -1,23 +1,20 @@ import pytest -from databricks.sdk import WorkspaceClient, AccountClient +from databricks.sdk import AccountClient, WorkspaceClient + @pytest.mark.parametrize( - "path,call", - [ - ("/api/2.0/preview/scim/v2/Users", lambda w: w.users.list()), - ("/api/2.0/preview/scim/v2/Groups", lambda w: w.groups.list()), - ("/api/2.0/preview/scim/v2/ServicePrincipals", lambda w: w.service_principals.list()), - ], + "path,call", [("/api/2.0/preview/scim/v2/Users", lambda w: w.users.list()), + ("/api/2.0/preview/scim/v2/Groups", lambda w: w.groups.list()), + ("/api/2.0/preview/scim/v2/ServicePrincipals", lambda w: w.service_principals.list()), ], ) def test_workspace_iam_list(config, requests_mock, path, call): - requests_mock.get( - f"http://localhost{path}", - request_headers={ - "Accept": "application/json", - }, - text="null", - ) + requests_mock.get(f"http://localhost{path}", + request_headers={ + "Accept": "application/json", + }, + text="null", + ) w = WorkspaceClient(config=config) for _ in call(w): pass @@ -27,23 +24,20 @@ def test_workspace_iam_list(config, requests_mock, path, call): @pytest.mark.parametrize( "path,call", - [ - ("/api/2.0/accounts/%s/scim/v2/Users", lambda a: a.users.list()), - ("/api/2.0/accounts/%s/scim/v2/Groups", lambda a: a.groups.list()), - ("/api/2.0/accounts/%s/scim/v2/ServicePrincipals", lambda a: a.service_principals.list()), - ], + [("/api/2.0/accounts/%s/scim/v2/Users", lambda a: a.users.list()), + ("/api/2.0/accounts/%s/scim/v2/Groups", lambda a: a.groups.list()), + ("/api/2.0/accounts/%s/scim/v2/ServicePrincipals", lambda a: a.service_principals.list()), ], ) def test_account_iam_list(config, requests_mock, path, call): config.account_id = "test_account_id" - requests_mock.get( - path.replace("%s", config.account_id), - request_headers={ - "Accept": "application/json", - }, - text="null", - ) + requests_mock.get(path.replace("%s", config.account_id), + request_headers={ + "Accept": "application/json", + }, + text="null", + ) a = AccountClient(config=config) for _ in call(a): pass assert requests_mock.call_count == 1 - assert requests_mock.called \ No newline at end of file + assert requests_mock.called