Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/_incydr_sdk/__version__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-present Code42 Software <integrations@code42.com>
#
# SPDX-License-Identifier: MIT
__version__ = "2.4.0"
__version__ = "2.5.0"
8 changes: 8 additions & 0 deletions src/_incydr_sdk/orgs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion tests/test_orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand All @@ -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)
Expand Down