From 416d840dc4cb00026bac2512b259ce88a0e4a765 Mon Sep 17 00:00:00 2001 From: TerryHowe <terrylhowe@gmail.com> Date: Sat, 25 Apr 2015 09:38:55 -0600 Subject: [PATCH] Reduce parameters to base class execute Simplify the parameters so we are just passing a command string to the execute command in the base class. The string is exactly the command we are going to run. This will make debugging easier and make it clearer what we are actually running. Change-Id: I0425007e1849f31d692420e38544c55b1acb86c4 --- functional/common/test.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/functional/common/test.py b/functional/common/test.py index 464844fad1..4a92def0d5 100644 --- a/functional/common/test.py +++ b/functional/common/test.py @@ -26,10 +26,8 @@ ROOT_DIR = os.path.normpath(os.path.join(FUNCTIONAL_DIR, '..')) EXAMPLE_DIR = os.path.join(ROOT_DIR, 'examples') -def execute(cmd, action, flags='', params='', fail_ok=False, - merge_stderr=False): +def execute(cmd, fail_ok=False, merge_stderr=False): """Executes specified command for the given action.""" - cmd = ' '.join([cmd, flags, action, params]) cmd = shlex.split(cmd.encode('utf-8')) result = '' result_err = '' @@ -47,9 +45,10 @@ class TestCase(testtools.TestCase): delimiter_line = re.compile('^\+\-[\+\-]+\-\+$') - def openstack(self, action, flags='', params='', fail_ok=False): + @classmethod + def openstack(cls, cmd, fail_ok=False): """Executes openstackclient command for the given action.""" - return execute('openstack', action, flags, params, fail_ok) + return execute('openstack ' + cmd, fail_ok=fail_ok) def assert_table_structure(self, items, field_names): """Verify that all items have keys listed in field_names."""