Clean functional tests in "test_cli_scenario" 79/46979/1
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Tue, 7 Nov 2017 16:48:15 +0000 (16:48 +0000)
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Tue, 7 Nov 2017 17:02:29 +0000 (17:02 +0000)
Changed how "test_cli_scenario" tests check the presence
of a string.

Fixed "test_scenario_show_Lmbench": logic in [1] was incorrectly
assigning an string value instead of the result of the "in"
clause.

[1] https://github.com/opnfv/yardstick/blob/stable/euphrates/tests/functional/test_cli_scenario.py#L35-L36

Change-Id: I71fceabad972e4c0d9e78cbfeb85dcd6a5ae4bda
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
tests/functional/test_cli_scenario.py

index 4741e82..63b533b 100755 (executable)
@@ -32,31 +32,25 @@ class ScenarioTestCase(unittest.TestCase):
 
     def test_scenario_show_Lmbench(self):
         res = self.yardstick("scenario show Lmbench")
-        lmbench = "Execute lmbench memory read latency"
-        "or memory bandwidth benchmark in a host" in res
-        self.assertTrue(lmbench)
+        self.assertIn("Execute lmbench memory read latency or memory "
+                      "bandwidth benchmark in a hos", res)
 
     def test_scenario_show_Perf(self):
         res = self.yardstick("scenario show Perf")
-        perf = "Execute perf benchmark in a host" in res
-        self.assertTrue(perf)
+        self.assertIn("Execute perf benchmark in a host", res)
 
     def test_scenario_show_Fio(self):
         res = self.yardstick("scenario show Fio")
-        fio = "Execute fio benchmark in a host" in res
-        self.assertTrue(fio)
+        self.assertIn("Execute fio benchmark in a host", res)
 
     def test_scenario_show_Ping(self):
         res = self.yardstick("scenario show Ping")
-        ping = "Execute ping between two hosts" in res
-        self.assertTrue(ping)
+        self.assertIn("Execute ping between two hosts", res)
 
     def test_scenario_show_Iperf3(self):
         res = self.yardstick("scenario show Iperf3")
-        iperf3 = "Execute iperf3 between two hosts" in res
-        self.assertTrue(iperf3)
+        self.assertIn("Execute iperf3 between two hosts", res)
 
     def test_scenario_show_Pktgen(self):
         res = self.yardstick("scenario show Pktgen")
-        pktgen = "Execute pktgen between two hosts" in res
-        self.assertTrue(pktgen)
+        self.assertIn("Execute pktgen between two hosts", res)