diff options
author | 2023-01-16 08:22:04 +0000 | |
---|---|---|
committer | 2023-01-16 09:35:34 +0000 | |
commit | b7948cee800b2e7b09065148cc326c5a35867550 (patch) | |
tree | 73593b9c5f7e2c640298c9016eb55ed6349e1c62 /tests | |
parent | 1b6a93d93fe6ac41eb221dc59c2171e9bdd578e3 (diff) |
Archive and delete SDC Resources
Issue-ID: INT-2193
Change-Id: I89f7e328dcc514ca632ca2193a80a9994a50cb59
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_sdc_element.py | 13 | ||||
-rwxr-xr-x | tests/test_service.py | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_sdc_element.py b/tests/test_sdc_element.py index 88bcd8f..8cfb907 100644 --- a/tests/test_sdc_element.py +++ b/tests/test_sdc_element.py @@ -107,3 +107,16 @@ def test_exists_versions(mock_vsp_created, mock_get_all): sdc_el2._identifier = "123" mock_get_all.return_value = [sdc_el1, sdc_el2] assert sdc_el1.exists() + +@mock.patch.object(SdcElement, "send_message") +def test_delete(mock_send_message): + vsp = Vsp("test_vsp") + vsp.identifier = "test_vsp" + vsp.delete() + mock_send_message.assert_called_once() + + mock_send_message.reset_mock() + vendor = Vendor("test_vendor") + vendor.identifier = "test_vendor" + vendor.delete() + mock_send_message.assert_called_once() diff --git a/tests/test_service.py b/tests/test_service.py index 7606ed2..3e3ec94 100755 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -15,6 +15,7 @@ from os import path from pathlib import Path +from tempfile import TemporaryDirectory from unittest import mock from unittest.mock import MagicMock, PropertyMock import shutil @@ -531,7 +532,8 @@ def test_get_tosca_bad_csart(requests_mock): requests_mock.get( 'https://sdc.api.be.simpledemo.onap.org:30204/sdc/v1/catalog/services/12/toscaModel', content=file_content) - svc.get_tosca('directory') + with TemporaryDirectory() as tempdir: + svc.get_tosca(tempdir) assert not path.exists('/tmp/tosca_files') |