Merge "Proposing Abhijit Sinha as a committer in Yardstick"
[yardstick.git] / tests / unit / network_services / traffic_profile / test_prox_binsearch.py
index 72b8670..c1f1c82 100644 (file)
@@ -37,8 +37,8 @@ class TestProxBinSearchProfile(unittest.TestCase):
             if args[2] < 0 or args[2] > 100:
                 raise RuntimeError(' '.join([str(args), str(runs)]))
             if args[2] > 75.0:
-                return fail_tuple
-            return success_tuple
+                return fail_tuple, {}
+            return success_tuple, {}
 
         tp_config = {
             'traffic_profile': {
@@ -51,12 +51,15 @@ class TestProxBinSearchProfile(unittest.TestCase):
         fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
 
         traffic_generator = mock.MagicMock()
-        traffic_generator.resource_helper.run_test = target
+
+        profile_helper = mock.MagicMock()
+        profile_helper.run_test = target
 
         profile = ProxBinSearchProfile(tp_config)
         profile.init(mock.MagicMock())
+        profile._profile_helper = profile_helper
 
-        profile.execute(traffic_generator)
+        profile.execute_traffic(traffic_generator)
         self.assertEqual(round(profile.current_lower, 2), 74.69)
         self.assertEqual(round(profile.current_upper, 2), 75.39)
         self.assertEqual(len(runs), 8)
@@ -67,8 +70,8 @@ class TestProxBinSearchProfile(unittest.TestCase):
             if args[2] < 0 or args[2] > 100:
                 raise RuntimeError(' '.join([str(args), str(runs)]))
             if args[2] > 25.0:
-                return fail_tuple
-            return success_tuple
+                return fail_tuple, {}
+            return success_tuple, {}
 
         tp_config = {
             'traffic_profile': {
@@ -82,12 +85,15 @@ class TestProxBinSearchProfile(unittest.TestCase):
         fail_tuple = ProxTestDataTuple(10.0, 1, 2, 3, 4, [5.6, 5.7, 5.8], 850, 1000, 123.4)
 
         traffic_generator = mock.MagicMock()
-        traffic_generator.resource_helper.run_test = target
+
+        profile_helper = mock.MagicMock()
+        profile_helper.run_test = target
 
         profile = ProxBinSearchProfile(tp_config)
         profile.init(mock.MagicMock())
+        profile._profile_helper = profile_helper
 
-        profile.execute(traffic_generator)
+        profile.execute_traffic(traffic_generator)
         self.assertEqual(round(profile.current_lower, 2), 24.06)
         self.assertEqual(round(profile.current_upper, 2), 25.47)
         self.assertEqual(len(runs), 7)