aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_service_macro_instantiation.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2020-11-25 10:52:03 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2020-12-16 12:54:40 +0000
commitaf63861d32daac92cfaf1e00842fa23bc6ba7c6b (patch)
tree634460460c186c219ae1df50cf0e04bffd2384ff /tests/test_service_macro_instantiation.py
parent6a19fe0a4bbf2319af52c34a21ceca88cadd84cd (diff)
PNF macro instantiation
Issue-ID: TEST-280 Change-Id: I6d18b90c3f4c66ddf8c9a4ebe3de7182481e331f Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'tests/test_service_macro_instantiation.py')
-rw-r--r--tests/test_service_macro_instantiation.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_service_macro_instantiation.py b/tests/test_service_macro_instantiation.py
new file mode 100644
index 0000000..382a86e
--- /dev/null
+++ b/tests/test_service_macro_instantiation.py
@@ -0,0 +1,42 @@
+from unittest import mock
+
+from onaptests.steps.instantiate.service_macro import (
+ YamlTemplateServiceMacroInstantiateStep
+)
+
+VNFS_PNFS_YAML = './tests/data/service_macro_template_vnfs.yaml'
+PNFS_YAML = './tests/data/service_macro_template_pnfs.yaml'
+
+
+@mock.patch("onaptests.steps.base.BaseStep.add_step")
+@mock.patch("onaptests.steps.instantiate.service_macro.settings")
+@mock.patch("onaptests.steps.instantiate.service_macro.YamlTemplateServiceOnboardStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.ConnectServiceSubToCloudRegionStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.CustomerServiceSubscriptionCreateStep")
+def test_are_vnfs(CustomerStep, CloudStep, OnboardStep, settings, add_step):
+
+ settings.SERVICE_YAML_TEMPLATE = VNFS_PNFS_YAML
+ settings.ONLY_INSTANTIATE = False
+
+ YamlTemplateServiceMacroInstantiateStep()
+
+ CustomerStep.assert_not_called()
+ assert add_step.mock_calls == [
+ mock.call(OnboardStep()), mock.call(CloudStep())]
+
+
+@mock.patch("onaptests.steps.base.BaseStep.add_step")
+@mock.patch("onaptests.steps.instantiate.service_macro.settings")
+@mock.patch("onaptests.steps.instantiate.service_macro.YamlTemplateServiceOnboardStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.ConnectServiceSubToCloudRegionStep")
+@mock.patch("onaptests.steps.instantiate.service_macro.CustomerServiceSubscriptionCreateStep")
+def test_are_pnfs(CustomerStep, CloudStep, OnboardStep, settings, add_step):
+
+ settings.SERVICE_YAML_TEMPLATE = PNFS_YAML
+ settings.ONLY_INSTANTIATE = False
+
+ YamlTemplateServiceMacroInstantiateStep()
+
+ CloudStep.assert_not_called()
+ assert add_step.mock_calls == [
+ mock.call(OnboardStep()), mock.call(CustomerStep())]