From 0dd7a103be470589a19391e48a4858cd9ab0c076 Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Tue, 9 Feb 2016 15:30:15 +0900 Subject: Add cli execute test case This commit adds a unit test case of cli.base.execute(). Originally, the failure test case asserts 'fail_ok=True' condition only. However, the execute() raises an exception when 'fail_ok=False'(default). So we should test the behavior in our unit test. Change-Id: I0d1a0dd74ad0884475010bdc88b899c41b86998a --- tempest_lib/tests/cli/test_execute.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tempest_lib/tests/cli/test_execute.py b/tempest_lib/tests/cli/test_execute.py index b56d614..c86f190 100644 --- a/tempest_lib/tests/cli/test_execute.py +++ b/tempest_lib/tests/cli/test_execute.py @@ -13,6 +13,7 @@ from tempest_lib.cli import base as cli_base +from tempest_lib import exceptions from tempest_lib.tests import base @@ -29,3 +30,8 @@ class TestExecute(base.TestCase): fail_ok=True) self.assertIsInstance(result, str) self.assertIn("--foobar", result) + + def test_execute_failure_raise_exception(self): + self.assertRaises(exceptions.CommandFailed, cli_base.execute, + "/bin/ls", action="tempest_lib", flags="--foobar", + merge_stderr=True) -- cgit v1.2.1