From 8b63fb04e2f3923cfb096f4aae045349511835a6 Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Fri, 2 Feb 2024 18:49:01 +0100 Subject: Fix SDC v2 lifecycleOperation bug Relese 13.0.2 version with fix Issue-ID: TEST-404 Change-Id: I076223ad3cb982fbf5035baa5254b1696f6408c7 Signed-off-by: Michal Jagiello --- src/onapsdk/sdc2/sdc_resource.py | 6 +++--- src/onapsdk/version.py | 2 +- tests/test_sdc2_pnf.py | 6 +++--- tests/test_sdc2_service.py | 6 +++--- tests/test_sdc2_vf.py | 6 +++--- tests/test_sdc2_vl.py | 6 +++--- tests/test_version.py | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/onapsdk/sdc2/sdc_resource.py b/src/onapsdk/sdc2/sdc_resource.py index 39d7d9a..107162c 100644 --- a/src/onapsdk/sdc2/sdc_resource.py +++ b/src/onapsdk/sdc2/sdc_resource.py @@ -403,14 +403,14 @@ class SDCResource(SDCCatalog): # pylint: disable=too-many-instance-attributes """ response: Dict[str, Any] = self.send_message_json( "POST", - (f"Request lifecycle operation {lifecycle_operation} on " + (f"Request lifecycle operation {lifecycle_operation.value} on " f"{self.__class__.__name__.upper()} object {self.name}"), urljoin(self.base_back_url, (f"sdc2/rest/v1/catalog/{self.catalog_type()}/" - f"{self.unique_id}/lifecycleState/{lifecycle_operation}")), + f"{self.unique_id}/lifecycleState/{lifecycle_operation.value}")), data=jinja_env().get_template( self.LIFECYCLE_OPERATION_TEMPLATE).render( - lifecycle_operation=lifecycle_operation) + lifecycle_operation=lifecycle_operation.value) ) self.update(response) diff --git a/src/onapsdk/version.py b/src/onapsdk/version.py index 8dc179f..c5f376b 100644 --- a/src/onapsdk/version.py +++ b/src/onapsdk/version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "13.0.1" +__version__ = "13.0.2" diff --git a/tests/test_sdc2_pnf.py b/tests/test_sdc2_pnf.py index 07834a5..01ba3fe 100644 --- a/tests/test_sdc2_pnf.py +++ b/tests/test_sdc2_pnf.py @@ -253,9 +253,9 @@ def test_lifecycle_operation(mock_update, mock_send_message_json): method, log, url = mock_send_message_json.mock_calls[0].args data = mock_send_message_json.mock_calls[0].kwargs["data"] assert method == "POST" - assert log.startswith(f"Request lifecycle operation {lifecycle_operation}") - assert url.endswith(f"sdc2/rest/v1/catalog/resources/{pnf_unique_id}/lifecycleState/{lifecycle_operation}") - assert json.loads(data)["userRemarks"] == str(lifecycle_operation).lower() + assert log.startswith(f"Request lifecycle operation {lifecycle_operation.value}") + assert url.endswith(f"sdc2/rest/v1/catalog/resources/{pnf_unique_id}/lifecycleState/{lifecycle_operation.value}") + assert json.loads(data)["userRemarks"] == str(lifecycle_operation.value).lower() mock_update.assert_called_once_with(return_dict) diff --git a/tests/test_sdc2_service.py b/tests/test_sdc2_service.py index 59e18b5..b189687 100644 --- a/tests/test_sdc2_service.py +++ b/tests/test_sdc2_service.py @@ -266,9 +266,9 @@ def test_lifecycle_operation(mock_update, mock_send_message_json): method, log, url = mock_send_message_json.mock_calls[0].args data = mock_send_message_json.mock_calls[0].kwargs["data"] assert method == "POST" - assert log.startswith(f"Request lifecycle operation {lifecycle_operation}") - assert url.endswith(f"sdc2/rest/v1/catalog/services/{service_unique_id}/lifecycleState/{lifecycle_operation}") - assert json.loads(data)["userRemarks"] == str(lifecycle_operation).lower() + assert log.startswith(f"Request lifecycle operation {lifecycle_operation.value}") + assert url.endswith(f"sdc2/rest/v1/catalog/services/{service_unique_id}/lifecycleState/{lifecycle_operation.value}") + assert json.loads(data)["userRemarks"] == str(lifecycle_operation.value).lower() mock_update.assert_called_once_with(return_dict) diff --git a/tests/test_sdc2_vf.py b/tests/test_sdc2_vf.py index a5657d5..a8ce472 100644 --- a/tests/test_sdc2_vf.py +++ b/tests/test_sdc2_vf.py @@ -253,9 +253,9 @@ def test_lifecycle_operation(mock_update, mock_send_message_json): method, log, url = mock_send_message_json.mock_calls[0].args data = mock_send_message_json.mock_calls[0].kwargs["data"] assert method == "POST" - assert log.startswith(f"Request lifecycle operation {lifecycle_operation}") - assert url.endswith(f"sdc2/rest/v1/catalog/resources/{vf_unique_id}/lifecycleState/{lifecycle_operation}") - assert json.loads(data)["userRemarks"] == str(lifecycle_operation).lower() + assert log.startswith(f"Request lifecycle operation {lifecycle_operation.value}") + assert url.endswith(f"sdc2/rest/v1/catalog/resources/{vf_unique_id}/lifecycleState/{lifecycle_operation.value}") + assert json.loads(data)["userRemarks"] == str(lifecycle_operation.value).lower() mock_update.assert_called_once_with(return_dict) diff --git a/tests/test_sdc2_vl.py b/tests/test_sdc2_vl.py index 8c7cd6b..b4e6788 100644 --- a/tests/test_sdc2_vl.py +++ b/tests/test_sdc2_vl.py @@ -250,9 +250,9 @@ def test_lifecycle_operation(mock_update, mock_send_message_json): method, log, url = mock_send_message_json.mock_calls[0].args data = mock_send_message_json.mock_calls[0].kwargs["data"] assert method == "POST" - assert log.startswith(f"Request lifecycle operation {lifecycle_operation}") - assert url.endswith(f"sdc2/rest/v1/catalog/resources/{vl_unique_id}/lifecycleState/{lifecycle_operation}") - assert json.loads(data)["userRemarks"] == str(lifecycle_operation).lower() + assert log.startswith(f"Request lifecycle operation {lifecycle_operation.value}") + assert url.endswith(f"sdc2/rest/v1/catalog/resources/{vl_unique_id}/lifecycleState/{lifecycle_operation.value}") + assert json.loads(data)["userRemarks"] == str(lifecycle_operation.value).lower() mock_update.assert_called_once_with(return_dict) diff --git a/tests/test_version.py b/tests/test_version.py index b3c9572..19299c1 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -17,4 +17,4 @@ import onapsdk.version as version def test_version(): """Check version is the right one.""" - assert version.__version__ == '13.0.1' + assert version.__version__ == '13.0.2' -- cgit 1.2.3-korg