From 2c349c67b11ea489ccd268057e09852b57442e99 Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Fri, 6 Jun 2025 13:58:47 -0400 Subject: [PATCH 1/2] fix bugs found in QA, bump version, and pin click version --- CHANGELOG.md | 2 +- pyproject.toml | 2 +- src/_incydr_sdk/__version__.py | 2 +- src/_incydr_sdk/orgs/client.py | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dad7d01..a4d6a6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The intended audience of this file is for `incydr` SDK and CLI consumers -- as such, changes that don't affect how a consumer would use the library or CLI tool (e.g. adding unit tests, updating documentation, etc) are not captured here. -## Unreleased +## 2.5.0 - 2025-06-06 ### Added diff --git a/pyproject.toml b/pyproject.toml index b412c83..585147e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ dependencies = [ dynamic = ["version"] [project.optional-dependencies] -cli = ["click", "chardet"] +cli = ["click==8.1.*", "chardet"] [project.urls] Documentation = "https://github.com/code42/incydr_python#readme" diff --git a/src/_incydr_sdk/__version__.py b/src/_incydr_sdk/__version__.py index 7bc78c6..de094a6 100644 --- a/src/_incydr_sdk/__version__.py +++ b/src/_incydr_sdk/__version__.py @@ -1,4 +1,4 @@ # SPDX-FileCopyrightText: 2022-present Code42 Software # # SPDX-License-Identifier: MIT -__version__ = "2.4.0" +__version__ = "2.5.0" diff --git a/src/_incydr_sdk/orgs/client.py b/src/_incydr_sdk/orgs/client.py index f803c04..87a5760 100644 --- a/src/_incydr_sdk/orgs/client.py +++ b/src/_incydr_sdk/orgs/client.py @@ -75,6 +75,14 @@ def create( pa **Returns**: An [`Org`][org-model] object representing the created org. """ + # Ensure parent org guid + if not parent_org_guid: + orgslist = self.list().orgs + id_list = list(map(lambda x: x.org_guid, orgslist)) + for org in orgslist: + if org.parent_org_guid not in id_list: + parent_org_guid = org.org_guid + break payload = { "orgName": org_name, "orgExtRef": org_ext_ref, From 8e73ee0bebdb1e2311df2e6f1736aaf92eef1594 Mon Sep 17 00:00:00 2001 From: Cecilia Stevens <63068179+ceciliastevens@users.noreply.github.com> Date: Fri, 6 Jun 2025 14:02:38 -0400 Subject: [PATCH 2/2] fix failing test --- tests/test_orgs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_orgs.py b/tests/test_orgs.py index 51f2517..972bcb2 100644 --- a/tests/test_orgs.py +++ b/tests/test_orgs.py @@ -25,7 +25,7 @@ "orgName": TEST_ORG_NAME, "orgExtRef": None, "notes": None, - "parentOrgGuid": None, + "parentOrgGuid": TEST_DATA["orgGuid"], } TEST_UPDATE_ORG_PAYLOAD = {"orgName": TEST_ORG_NAME, "orgExtRef": None, "notes": None} TEST_ORG_LIST = {"totalCount": 1, "orgs": [TEST_DATA]} @@ -41,6 +41,9 @@ def mock_get_org(httpserver_auth: HTTPServer): @pytest.fixture def mock_create_org(httpserver_auth: HTTPServer): + httpserver_auth.expect_request("/v1/orgs", method="GET").respond_with_json( + response_json=TEST_ORG_LIST, status=200 + ) httpserver_auth.expect_request( "/v1/orgs", method="POST", json=TEST_CREATE_ORG_PAYLOAD ).respond_with_json(response_json=TEST_DATA, status=200)