X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Funit%2Fnetwork_services%2Ftraffic_profile%2Ftest_prox_ramp.py;h=1acec2f685c4809bef67727a3dd51fa9fcc67286;hb=4e5893873d684069e57b2ef91a75b446bb319d56;hp=357298759dc72b88f9b50865d532b9bf3a2de816;hpb=b2552579f300ec9f4c2b516eb44cac0efb3d4dd6;p=yardstick.git diff --git a/tests/unit/network_services/traffic_profile/test_prox_ramp.py b/tests/unit/network_services/traffic_profile/test_prox_ramp.py index 357298759..1acec2f68 100644 --- a/tests/unit/network_services/traffic_profile/test_prox_ramp.py +++ b/tests/unit/network_services/traffic_profile/test_prox_ramp.py @@ -26,6 +26,7 @@ stl_patch.start() if stl_patch: from yardstick.network_services.traffic_profile.prox_ramp import ProxRampProfile + from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxProfileHelper from yardstick.network_services.vnf_generic.vnf.prox_helpers import ProxTestDataTuple @@ -43,14 +44,18 @@ class TestProxRampProfile(unittest.TestCase): success_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4) traffic_gen = mock.MagicMock() - traffic_gen.resource_helper.run_test.return_value = success_tuple + traffic_gen._test_type = 'Generic' + + profile_helper = ProxProfileHelper(traffic_gen.resource_helper) + profile_helper.run_test = run_test = mock.MagicMock(return_value=success_tuple) profile = ProxRampProfile(tp_config) profile.fill_samples = fill_samples = mock.MagicMock() profile.queue = mock.MagicMock() + profile._profile_helper = profile_helper profile.run_test_with_pkt_size(traffic_gen, 128, 30) - self.assertEqual(traffic_gen.resource_helper.run_test.call_count, 10) + self.assertEqual(run_test.call_count, 10) self.assertEqual(fill_samples.call_count, 10) def test_run_test_with_pkt_size_with_fail(self): @@ -65,8 +70,7 @@ class TestProxRampProfile(unittest.TestCase): success_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.1, 5.2, 5.3], 995, 1000, 123.4) fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4) - traffic_gen = mock.MagicMock() - traffic_gen.resource_helper.run_test.side_effect = [ + result_list = [ success_tuple, success_tuple, success_tuple, @@ -77,10 +81,17 @@ class TestProxRampProfile(unittest.TestCase): fail_tuple, ] + traffic_gen = mock.MagicMock() + traffic_gen._test_type = 'Generic' + + profile_helper = ProxProfileHelper(traffic_gen.resource_helper) + profile_helper.run_test = run_test = mock.MagicMock(side_effect=result_list) + profile = ProxRampProfile(tp_config) profile.fill_samples = fill_samples = mock.MagicMock() profile.queue = mock.MagicMock() + profile._profile_helper = profile_helper profile.run_test_with_pkt_size(traffic_gen, 128, 30) - self.assertEqual(traffic_gen.resource_helper.run_test.call_count, 4) + self.assertEqual(run_test.call_count, 4) self.assertEqual(fill_samples.call_count, 3)