diff options
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') |