-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from sw360/39-deleting-a-project-is-breaking-c…
…lient-because-of-empty-body-in-response 39 deleting a project is breaking client because of empty body in response
- Loading branch information
Showing
14 changed files
with
482 additions
and
591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# SPDX-FileCopyrightText: (c) 2018-2024 Siemens | ||
# SPDX-FileCopyrightText: (c) 2018-2025 Siemens | ||
# SPDX-License-Identifier: MIT | ||
|
||
[tool.poetry] | ||
name = "sw360" | ||
version = "1.8.0" | ||
version = "1.8.1" | ||
description = "Python interface to the SW360 software component catalogue" | ||
authors = ["Thomas Graf <[email protected]>", | ||
"Gernot Hillier <[email protected]>"] | ||
|
@@ -73,3 +73,4 @@ no_implicit_reexport = true | |
|
||
[tool.codespell] | ||
skip = "test_all_components.json,test_all_releases.json,./htmlcov/*,./__internal__/*,./docs/_static/*,./docs/searchindex.js,./docs/objects.inv" | ||
ignore-words-list = "visbility" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2024 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# All Rights Reserved. | ||
# Author: [email protected] | ||
# | ||
# Licensed under the MIT license. | ||
# SPDX-License-Identifier: MIT | ||
# ------------------------------------------------------------------------------- | ||
|
||
__version__ = (1, 8, 0) | ||
__version__ = (1, 8, 1) | ||
|
||
from .sw360_api import SW360 | ||
from .sw360error import SW360Error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2024 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# Copyright (c) 2022 BMW CarIT GmbH | ||
# All Rights Reserved. | ||
# Authors: [email protected], [email protected] | ||
|
@@ -313,7 +313,8 @@ def delete_component(self, component_id: str) -> Optional[Dict[str, Any]]: | |
response = self.api_delete(url) | ||
if response is not None: | ||
if response.ok: | ||
return response.json() | ||
if response.text: | ||
return response.json() | ||
return None | ||
|
||
def get_users_of_component(self, component_id: str) -> Optional[Dict[str, Any]]: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2022 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# Copyright (c) 2022 BMW CarIT GmbH | ||
# All Rights Reserved. | ||
# Authors: [email protected], [email protected] | ||
|
@@ -68,6 +68,8 @@ def delete_license(self, license_shortname: str) -> Optional[bool]: | |
:raises SW360Error: if there is a negative HTTP response | ||
""" | ||
|
||
# 2025-01-23: returns 500 - internal server error | ||
|
||
if not license_shortname: | ||
raise SW360Error(message="No license shortname provided!") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2024 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# Copyright (c) 2022 BMW CarIT GmbH | ||
# All Rights Reserved. | ||
# Authors: [email protected], [email protected] | ||
|
@@ -239,7 +239,8 @@ def delete_release(self, release_id: str) -> Optional[Dict[str, Any]]: | |
response = self.api_delete(url) | ||
if response is not None: | ||
if response.ok: | ||
return response.json() | ||
if response.text: | ||
return response.json() | ||
return None | ||
|
||
def get_users_of_release(self, release_id: str) -> Optional[Dict[str, Any]]: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2023 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# Copyright (c) 2022 BMW CarIT GmbH | ||
# All Rights Reserved. | ||
# Authors: [email protected], [email protected] | ||
|
@@ -83,7 +83,7 @@ def update_vendor(self, vendor: Dict[str, Any], vendor_id: str) -> Optional[Dict | |
url = self.url + "resource/api/vendors/" + vendor_id | ||
return self.api_patch(url, json=vendor) | ||
|
||
def delete_vendor(self, vendor_id: str) -> Dict[str, Any]: | ||
def delete_vendor(self, vendor_id: str) -> Optional[Dict[str, Any]]: | ||
"""Delete an existing vendor | ||
API endpoint: DELETE /vendors | ||
|
@@ -93,7 +93,7 @@ def delete_vendor(self, vendor_id: str) -> Dict[str, Any]: | |
:raises SW360Error: if there is a negative HTTP response | ||
""" | ||
|
||
# 2019-04-03: error 405 - not allowed | ||
# 2019-04-03/2025-01-23: error 405 - not allowed | ||
|
||
if not vendor_id: | ||
raise SW360Error(message="No vendor id provided!") | ||
|
@@ -103,5 +103,7 @@ def delete_vendor(self, vendor_id: str) -> Dict[str, Any]: | |
response = self.api_delete(url) | ||
if response is not None: | ||
if response.ok: | ||
return response.json() | ||
raise SW360Error(response, url) | ||
if response.text: | ||
return response.json() | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2020-2024 Siemens | ||
# Copyright (c) 2020-2025 Siemens | ||
# All Rights Reserved. | ||
# Author: [email protected] | ||
# | ||
|
@@ -767,7 +767,7 @@ def test_delete_component(self) -> None: | |
responses.add( | ||
responses.DELETE, | ||
url=self.MYURL + "resource/api/components/123", | ||
body="4", | ||
body='{\n "resourceId" : "468abcd6e7f849199d9323c9a16b2776",\n "status" : 200\n}', | ||
status=200, | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2019-2024 Siemens | ||
# Copyright (c) 2019-2025 Siemens | ||
# All Rights Reserved. | ||
# Author: [email protected] | ||
# | ||
|
@@ -1118,6 +1118,19 @@ def test_delete_project(self) -> None: | |
|
||
lib.delete_project("123") | ||
|
||
@responses.activate | ||
def test_delete_project_empty_response(self) -> None: | ||
lib = self.get_logged_in_lib() | ||
|
||
responses.add( | ||
responses.DELETE, | ||
url=self.MYURL + "resource/api/projects/123", | ||
body="", | ||
status=200, | ||
) | ||
|
||
lib.delete_project("123") | ||
|
||
@responses.activate | ||
def test_delete_project_no_id(self) -> None: | ||
lib = self.get_logged_in_lib() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# ------------------------------------------------------------------------------- | ||
# Copyright (c) 2023-2024 Siemens | ||
# Copyright (c) 2023-2025 Siemens | ||
# All Rights Reserved. | ||
# Author: [email protected] | ||
# | ||
|
@@ -530,7 +530,7 @@ def test_delete_release(self) -> None: | |
responses.add( | ||
responses.DELETE, | ||
url=self.MYURL + "resource/api/releases/123", | ||
body="4", | ||
body='{\n "resourceId" : "8ddc6d15e0c4424ea756b8e0b77ad1e9",\n "status" : 200\n}', | ||
status=200, | ||
) | ||
|
||
|