Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmay-db committed Dec 12, 2024
1 parent b30571e commit f61c48e
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions tests/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@


@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",
[("http://localhost/api/2.0/preview/scim/v2/Users", lambda w: w.users.list()),
("http://localhost/api/2.0/preview/scim/v2/Groups", lambda w: w.groups.list()),
("http://localhost/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(path, request_headers={"Accept": "application/json", }, text="null", )
w = WorkspaceClient(config=config)
for _ in call(w):
pass
assert requests_mock.call_count == 1
assert requests_mock.called


@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()), ],
)
@pytest.mark.parametrize("path,call", [
("http://localhost/api/2.0/accounts/%s/scim/v2/Users", lambda a: a.users.list()),
("http://localhost/api/2.0/accounts/%s/scim/v2/Groups", lambda a: a.groups.list()),
("http://localhost/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),
Expand Down

0 comments on commit f61c48e

Please sign in to comment.