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
This commit is contained in:
parent
1abd727c11
commit
0dd7a103be
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user