aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark/scenarios
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2018-11-05 12:03:58 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-11-05 12:03:58 +0000
commite13f82dc70084480611bab5aa04ac126c0b1ff0e (patch)
tree3cb2748d7fc5a47892e68276212f46102a24a72d /yardstick/tests/unit/benchmark/scenarios
parent9d4930bdfb80437a3149b080f195416814a44b75 (diff)
parent383c438cda94a1004bc9552a5993fe3ff3e6da8f (diff)
Merge "Test case override of traffic profile settings."
Diffstat (limited to 'yardstick/tests/unit/benchmark/scenarios')
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
index 6bf2f2c2f..90248d1bf 100644
--- a/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
+++ b/yardstick/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py
@@ -629,7 +629,7 @@ class TestNetworkServiceTestCase(unittest.TestCase):
@mock.patch.object(vnfdgen, 'generate_vnfd')
def test__fill_traffic_profile(self, mock_generate, mock_tprofile_get):
fake_tprofile = mock.Mock()
- fake_vnfd = mock.Mock()
+ fake_vnfd = mock.MagicMock()
with mock.patch.object(self.s, '_get_traffic_profile',
return_value=fake_tprofile) as mock_get_tp:
mock_generate.return_value = fake_vnfd
@@ -646,6 +646,22 @@ class TestNetworkServiceTestCase(unittest.TestCase):
)
mock_tprofile_get.assert_called_once_with(fake_vnfd)
+ @mock.patch.object(base.TrafficProfile, 'get')
+ @mock.patch.object(vnfdgen, 'generate_vnfd')
+ def test__fill_traffic_profile2(self, mock_generate, mock_tprofile_get):
+ fake_tprofile = mock.Mock()
+ fake_vnfd = {}
+ with mock.patch.object(self.s, '_get_traffic_profile',
+ return_value=fake_tprofile) as mock_get_tp:
+ mock_generate.return_value = fake_vnfd
+
+ self.s.scenario_cfg["options"] = {"traffic_config": {"duration": 99899}}
+ self.s._fill_traffic_profile()
+ mock_get_tp.assert_called_once()
+ self.assertIn("traffic_profile", fake_vnfd)
+ self.assertIn("duration", fake_vnfd["traffic_profile"])
+ self.assertEqual(99899, fake_vnfd["traffic_profile"]["duration"])
+
@mock.patch.object(utils, 'open_relative_file')
def test__get_topology(self, mock_open_path):
self.s.scenario_cfg['topology'] = 'fake_topology'