aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-08-14 18:24:21 +0100
committerEmma Foley <emma.l.foley@intel.com>2019-02-07 17:07:39 +0000
commit45bbcaf1dbd5342e687c3e859f6329de67db7ae9 (patch)
tree27a6e5089567c4c3ad76d201635c4589e31244c0
parent7c059eeefe0b9b5b367aa0a1b2092db9c68f1f19 (diff)
Rework TestScenarioHelper
Update network_services/vnf_generic/vnf/test_sample_vnf.py JIRA: YARDSTICK-1434 Change-Id: I1bbf2bc139f3302d9882b28f9883e64fa595eb46 Signed-off-by: Emma Foley <emma.l.foley@intel.com>
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py40
1 files changed, 18 insertions, 22 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index 929dd6ebb..8aa59ccd1 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -28,7 +28,6 @@ from yardstick.network_services.nfvi import resource
from yardstick.network_services.vnf_generic.vnf import base
from yardstick.network_services.vnf_generic.vnf import sample_vnf
from yardstick.network_services.vnf_generic.vnf import vnf_ssh_helper
-from yardstick.network_services.vnf_generic.vnf.sample_vnf import ScenarioHelper
from yardstick.network_services.vnf_generic.vnf.sample_vnf import ResourceHelper
from yardstick.network_services.vnf_generic.vnf.sample_vnf import SetupEnvHelper
from yardstick.network_services.vnf_generic.vnf.sample_vnf import SampleVNF
@@ -1102,22 +1101,23 @@ class TestSampleVNFDeployHelper(unittest.TestCase):
class TestScenarioHelper(unittest.TestCase):
+ def setUp(self):
+ self.scenario_helper = sample_vnf.ScenarioHelper('name1')
+
def test_property_task_path(self):
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'task_path': 'my_path',
}
- self.assertEqual(scenario_helper.task_path, 'my_path')
+ self.assertEqual(self.scenario_helper.task_path, 'my_path')
def test_property_nodes(self):
nodes = ['node1', 'node2']
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'nodes': nodes,
}
- self.assertEqual(scenario_helper.nodes, nodes)
+ self.assertEqual(self.scenario_helper.nodes, nodes)
def test_property_all_options(self):
data = {
@@ -1126,30 +1126,27 @@ class TestScenarioHelper(unittest.TestCase):
},
'name2': {}
}
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'options': data,
}
- self.assertDictEqual(scenario_helper.all_options, data)
+ self.assertDictEqual(self.scenario_helper.all_options, data)
def test_property_options(self):
data = {
'key1': 'value1',
'key2': 'value2',
}
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'options': {
'name1': data,
},
}
- self.assertDictEqual(scenario_helper.options, data)
+ self.assertDictEqual(self.scenario_helper.options, data)
def test_property_vnf_cfg(self):
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'options': {
'name1': {
'vnf_config': 'my_config',
@@ -1157,25 +1154,24 @@ class TestScenarioHelper(unittest.TestCase):
},
}
- self.assertEqual(scenario_helper.vnf_cfg, 'my_config')
+ self.assertEqual(self.scenario_helper.vnf_cfg, 'my_config')
def test_property_vnf_cfg_default(self):
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'options': {
'name1': {},
},
}
- self.assertDictEqual(scenario_helper.vnf_cfg, ScenarioHelper.DEFAULT_VNF_CFG)
+ self.assertEqual(self.scenario_helper.vnf_cfg,
+ sample_vnf.ScenarioHelper.DEFAULT_VNF_CFG)
def test_property_topology(self):
- scenario_helper = ScenarioHelper('name1')
- scenario_helper.scenario_cfg = {
+ self.scenario_helper.scenario_cfg = {
'topology': 'my_topology',
}
- self.assertEqual(scenario_helper.topology, 'my_topology')
+ self.assertEqual(self.scenario_helper.topology, 'my_topology')
class TestSampleVnf(unittest.TestCase):