Merge "bugfix: tc054 default value is wrong"
[yardstick.git] / tests / unit / cmd / test_NSBperf.py
index d63af49..e1b4da7 100644 (file)
@@ -25,11 +25,11 @@ from yardstick.cmd.NSBperf import YardstickNSCli
 from yardstick.cmd import NSBperf
 
 
-@mock.patch('__builtin__.raw_input', return_value='0')
+@mock.patch('six.moves.input', return_value='0')
 class TestHandler(unittest.TestCase):
     def test_handler(self, test):
         subprocess.call = mock.Mock(return_value=0)
-        self.assertRaises(SystemExit, NSBperf.handler)
+        self.assertRaises(SystemExit, NSBperf.sigint_handler)
 
 
 class TestYardstickNSCli(unittest.TestCase):
@@ -40,7 +40,8 @@ class TestYardstickNSCli(unittest.TestCase):
     def test_generate_final_report(self):
         yardstick_ns_cli = YardstickNSCli()
         test_case = "tc_baremetal_rfc2544_ipv4_1flow_1518B.yaml"
-        subprocess.call(["touch", "/tmp/yardstick.out"])
+        if os.path.isfile("/tmp/yardstick.out"):
+            os.remove('/tmp/yardstick.out')
         self.assertIsNone(yardstick_ns_cli.generate_final_report(test_case))
 
     def test_generate_kpi_results(self):
@@ -111,7 +112,7 @@ class TestYardstickNSCli(unittest.TestCase):
     def test_validate_input(self):
         yardstick_ns_cli = YardstickNSCli()
         self.assertEqual(1, yardstick_ns_cli.validate_input("", 4))
-        NSBperf.raw_input = lambda _: 'yes'
+        NSBperf.input = lambda _: 'yes'
         self.assertEqual(1, yardstick_ns_cli.validate_input(5, 4))
         subprocess.call = mock.Mock(return_value=0)
         self.assertEqual(0, yardstick_ns_cli.validate_input(2, 4))