aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_pnf_resource.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2022-02-07 14:02:54 +0000
committerGerrit Code Review <gerrit@onap.org>2022-02-07 14:02:54 +0000
commit4eeead2dd7f6dec678c8e581132c7907c4d755d8 (patch)
tree15f0159088a011161038ac74b55ca210185f5d1f /tests/test_pnf_resource.py
parent1039c4daafe70253d0012e97b3e26e76fe84f3a0 (diff)
parent7f6332466912bbc0886756d40e34128861a39259 (diff)
Merge "Add vfc resource support for xnfs"
Diffstat (limited to 'tests/test_pnf_resource.py')
-rw-r--r--tests/test_pnf_resource.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/test_pnf_resource.py b/tests/test_pnf_resource.py
index c58717a..62dc3ae 100644
--- a/tests/test_pnf_resource.py
+++ b/tests/test_pnf_resource.py
@@ -1,4 +1,4 @@
-from unittest.mock import patch, PropertyMock
+from unittest.mock import MagicMock, patch, PropertyMock
from onap_data_provider.resources.pnf_resource import PnfResource
@@ -26,3 +26,37 @@ def test_pnf_resource_pnf(mock_pnf_created):
assert pnf_resource.pnf is None
mock_pnf_created.return_value = True
assert pnf_resource.pnf is not None
+
+
+@patch(
+ "onap_data_provider.resources.pnf_resource.Pnf.create",
+)
+@patch(
+ "onap_data_provider.resources.pnf_resource.Pnf.add_resource",
+)
+@patch(
+ "onap_data_provider.resources.pnf_resource.Pnf.onboard",
+)
+@patch(
+ "onap_data_provider.resources.pnf_resource.PnfResource.pnf",
+ new_callable=PropertyMock,
+)
+@patch(
+ "onap_data_provider.resources.xnf_resource.Vfc",
+)
+def test_pnf_resource_onboards_with_vfc(
+ mock_vfc, mock_pnf, mock_onboard, mock_add_resource, mock_pnf_create
+):
+ mock_vfc = MagicMock()
+ mock_pnf.return_value = None
+ data_no_composition = {"name": "test_pnf"}
+ pnf_resource = PnfResource(data_no_composition)
+ pnf_resource.create()
+ mock_add_resource.assert_not_called()
+ data_with_composition = {
+ "name": "test_pnf",
+ "resources": [{"name": "test", "xnf_type": "VFC"}],
+ }
+ pnf_resource = PnfResource(data_with_composition)
+ pnf_resource.create()
+ mock_add_resource.assert_called_once()