summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tag_handlers.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_tag_handlers.py b/tests/test_tag_handlers.py
index 719295f..c7c9ffc 100644
--- a/tests/test_tag_handlers.py
+++ b/tests/test_tag_handlers.py
@@ -1,5 +1,8 @@
from unittest.mock import patch, PropertyMock
-from onap_data_provider.tag_handlers import join, generate_random_uuid
+
+import pytest
+
+from onap_data_provider.tag_handlers import join, generate_random_uuid, resource_property
def test_generate_random_uuid():
@@ -13,3 +16,14 @@ def test_generate_random_uuid():
def test_join(mock_safe_loader):
mock_safe_loader.construct_sequence.return_value = ["-", ["cloud", "owner", "DC1"]]
assert join(mock_safe_loader, None) == "cloud-owner-DC1"
+
+
+@patch("yaml.SafeLoader", new_callable=PropertyMock)
+@patch("onap_data_provider.property_tag.sdc_service.Service")
+def test_resource_property(mock_service, mock_safe_loader):
+ mock_safe_loader.construct_scalar.return_value = "unknown"
+ with pytest.raises(ValueError, match="Resource type \"unknown\" is not supported"):
+ resource_property(mock_safe_loader, None)
+ mock_service.return_value.identifier = "123"
+ mock_safe_loader.construct_scalar.return_value = "service identifier test_name"
+ assert resource_property(mock_safe_loader, None) == "123"