cli_testcase and cli_tier have been refactored to avoid duplicating
code. Then functest/cli and funtest/unit/cli can be added to the list
of modules rated 10/10.
Change-Id: Iec90e806397248a10f39080ec554e3f0a6eda7c1
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
+
import logging.config
import pkg_resources
import logging.config
import pkg_resources
from functest.cli.commands.cli_env import CliEnv
from functest.cli.commands.cli_os import CliOpenStack
from functest.cli.commands.cli_testcase import CliTestcase
from functest.cli.commands.cli_env import CliEnv
from functest.cli.commands.cli_os import CliOpenStack
from functest.cli.commands.cli_testcase import CliTestcase
logging.captureWarnings(True)
logging.captureWarnings(True)
-_env = CliEnv()
-_openstack = CliOpenStack()
-_testcase = CliTestcase()
-_tier = CliTier()
+ENV = CliEnv()
+OPENSTACK = CliOpenStack()
+TESTCASE = CliTestcase()
+TIER = CliTier()
@cli.group()
@click.pass_context
@cli.group()
@click.pass_context
+def env(ctx): # pylint: disable=unused-argument
pass
@cli.group()
@click.pass_context
pass
@cli.group()
@click.pass_context
+def openstack(ctx): # pylint: disable=unused-argument
pass
@cli.group()
@click.pass_context
pass
@cli.group()
@click.pass_context
+def testcase(ctx): # pylint: disable=unused-argument
pass
@cli.group()
@click.pass_context
pass
@cli.group()
@click.pass_context
+def tier(ctx): # pylint: disable=unused-argument
pass
@openstack.command('check', help="Checks connectivity and status "
"to the OpenStack deployment.")
def os_check():
pass
@openstack.command('check', help="Checks connectivity and status "
"to the OpenStack deployment.")
def os_check():
@openstack.command('show-credentials',
help="Prints the OpenStack credentials.")
def os_show_credentials():
@openstack.command('show-credentials',
help="Prints the OpenStack credentials.")
def os_show_credentials():
- _openstack.show_credentials()
+ OPENSTACK.show_credentials()
@env.command('show', help="Shows information about the current environment.")
def env_show():
@env.command('show', help="Shows information about the current environment.")
def env_show():
@testcase.command('list', help="Lists the available testcases.")
def testcase_list():
@testcase.command('list', help="Lists the available testcases.")
def testcase_list():
@testcase.command('show', help="Shows information about a test case.")
@click.argument('testname', type=click.STRING, required=True)
def testcase_show(testname):
@testcase.command('show', help="Shows information about a test case.")
@click.argument('testname', type=click.STRING, required=True)
def testcase_show(testname):
- _testcase.show(testname)
+ TESTCASE.show(testname)
@testcase.command('run', help="Executes a test case.")
@testcase.command('run', help="Executes a test case.")
help='Push results to the results DataBase. Only CI Pods'
'have rights to do that.')
def testcase_run(testname, noclean, report):
help='Push results to the results DataBase. Only CI Pods'
'have rights to do that.')
def testcase_run(testname, noclean, report):
- _testcase.run(testname, noclean, report)
+ TESTCASE.run(testname, noclean, report)
@tier.command('list', help="Lists the available tiers.")
def tier_list():
@tier.command('list', help="Lists the available tiers.")
def tier_list():
@tier.command('show', help="Shows information about a tier.")
@click.argument('tiername', type=click.STRING, required=True)
def tier_show(tiername):
@tier.command('show', help="Shows information about a tier.")
@click.argument('tiername', type=click.STRING, required=True)
def tier_show(tiername):
@tier.command('get-tests', help="Prints the tests in a tier.")
@click.argument('tiername', type=click.STRING, required=True)
def tier_gettests(tiername):
@tier.command('get-tests', help="Prints the tests in a tier.")
@click.argument('tiername', type=click.STRING, required=True)
def tier_gettests(tiername):
- _tier.gettests(tiername)
+ TIER.gettests(tiername)
@tier.command('run', help="Executes all the tests within a tier.")
@tier.command('run', help="Executes all the tests within a tier.")
help='Push results to the results DataBase. Only CI Pods'
'have rights to do that.')
def tier_run(tiername, noclean, report):
help='Push results to the results DataBase. Only CI Pods'
'have rights to do that.')
def tier_run(tiername, noclean, report):
- _tier.run(tiername, noclean, report)
+ TIER.run(tiername, noclean, report)
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+
+# pylint: disable=missing-docstring
import click
import prettytable
import click
import prettytable
+class Env(object): # pylint: disable=too-few-public-methods
- def __init__(self):
- pass
-
- def show(self):
+ @staticmethod
+ def show():
def _get_value(attr, default='Unknown'):
return attr if attr else default
def _get_value(attr, default='Unknown'):
return attr if attr else default
-class CliEnv(Env):
-
- def __init__(self):
- super(CliEnv, self).__init__()
+class CliEnv(object): # pylint: disable=too-few-public-methods
- def show(self):
- env_info = super(CliEnv, self).show()
+ @staticmethod
+ def show():
+ env_info = Env.show()
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
field_names=['Functest Environment', 'value'])
msg = prettytable.PrettyTable(
header_style='upper', padding_width=5,
field_names=['Functest Environment', 'value'])
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
+# pylint: disable=missing-docstring
-from six.moves.urllib.parse import urlparse
+from six.moves import urllib
from functest.ci import check_deployment
from functest.utils.constants import CONST
from functest.ci import check_deployment
from functest.utils.constants import CONST
self.endpoint_port = None
self.openstack_creds = CONST.__getattribute__('openstack_creds')
if self.os_auth_url:
self.endpoint_port = None
self.openstack_creds = CONST.__getattribute__('openstack_creds')
if self.os_auth_url:
- self.endpoint_ip = urlparse(self.os_auth_url).hostname
- self.endpoint_port = urlparse(self.os_auth_url).port
+ self.endpoint_ip = urllib.parse.urlparse(self.os_auth_url).hostname
+ self.endpoint_port = urllib.parse.urlparse(self.os_auth_url).port
def ping_endpoint(self):
if self.os_auth_url is None:
def ping_endpoint(self):
if self.os_auth_url is None:
class CliOpenStack(OpenStack):
class CliOpenStack(OpenStack):
- def __init__(self):
- super(CliOpenStack, self).__init__()
-
@staticmethod
def show_credentials():
dic_credentials = OpenStack.show_credentials()
for key, value in dic_credentials.items():
@staticmethod
def show_credentials():
dic_credentials = OpenStack.show_credentials()
for key, value in dic_credentials.items():
- if key.startswith('OS_'):
- click.echo("{}={}".format(key, value))
+ if key.startswith('OS_'):
+ click.echo("{}={}".format(key, value))
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-#
-
-""" global variables """
+# pylint: disable=missing-docstring
-import functest.ci.tier_builder as tb
-from functest.utils.constants import CONST
-import functest.utils.functest_utils as ft_utils
-
+from functest.cli.commands import cli_tier
+from functest.utils import functest_utils
- def __init__(self):
- self.tiers = tb.TierBuilder(
- CONST.__getattribute__('INSTALLER_TYPE'),
- CONST.__getattribute__('DEPLOY_SCENARIO'),
- pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
+class Testcase(cli_tier.Tier):
def list(self):
summary = ""
def list(self):
summary = ""
summary += (" %s\n" % test.get_name())
return summary
summary += (" %s\n" % test.get_name())
return summary
- def show(self, testname):
- description = self.tiers.get_test(testname)
+ def show(self, name):
+ description = self.tiers.get_test(name)
return description
@staticmethod
return description
@staticmethod
- def run(testname, noclean=False, report=False):
-
- flags = ""
- if noclean:
- flags += "-n "
- if report:
- flags += "-r "
-
- tests = testname.split(",")
+ def run(name, noclean=False, report=False):
+ tests = name.split(",")
- cmd = "run_tests {}-t {}".format(flags, test)
- ft_utils.execute_command(cmd)
+ cmd = "run_tests {}-t {}".format(
+ Testcase.get_flags(noclean, report), test)
+ functest_utils.execute_command(cmd)
class CliTestcase(Testcase):
class CliTestcase(Testcase):
- def __init__(self):
- super(CliTestcase, self).__init__()
-
def list(self):
click.echo(super(CliTestcase, self).list())
def list(self):
click.echo(super(CliTestcase, self).list())
- def show(self, testname):
- testcase_show = super(CliTestcase, self).show(testname)
+ def show(self, name):
+ testcase_show = super(CliTestcase, self).show(name)
if testcase_show:
click.echo(testcase_show)
else:
click.echo("The test case '%s' does not exist or is not supported."
if testcase_show:
click.echo(testcase_show)
else:
click.echo("The test case '%s' does not exist or is not supported."
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-""" global variables """
+# pylint: disable=missing-docstring
import pkg_resources
import click
import pkg_resources
import click
-import functest.ci.tier_builder as tb
+from functest.ci import tier_builder
from functest.utils.constants import CONST
from functest.utils.constants import CONST
-import functest.utils.functest_utils as ft_utils
+from functest.utils import functest_utils
class Tier(object):
def __init__(self):
class Tier(object):
def __init__(self):
- self.tiers = tb.TierBuilder(
+ self.tiers = tier_builder.TierBuilder(
CONST.__getattribute__('INSTALLER_TYPE'),
CONST.__getattribute__('DEPLOY_SCENARIO'),
pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
CONST.__getattribute__('INSTALLER_TYPE'),
CONST.__getattribute__('DEPLOY_SCENARIO'),
pkg_resources.resource_filename('functest', 'ci/testcases.yaml'))
tier.get_test_names()))
return summary
tier.get_test_names()))
return summary
- def show(self, tiername):
- tier = self.tiers.get_tier(tiername)
+ def show(self, name):
+ tier = self.tiers.get_tier(name)
if tier is None:
return None
if tier is None:
return None
- else:
- tier_info = self.tiers.get_tier(tiername)
- return tier_info
+ tier_info = self.tiers.get_tier(name)
+ return tier_info
- def gettests(self, tiername):
- tier = self.tiers.get_tier(tiername)
+ def gettests(self, name):
+ tier = self.tiers.get_tier(name)
if tier is None:
return None
if tier is None:
return None
- else:
- tests = tier.get_test_names()
- return tests
+ tests = tier.get_test_names()
+ return tests
- def run(tiername, noclean=False, report=False):
+ def get_flags(noclean=False, report=False):
flags = ""
if noclean:
flags += "-n "
if report:
flags += "-r "
flags = ""
if noclean:
flags += "-n "
if report:
flags += "-r "
- cmd = "run_tests {}-t {}".format(flags, tiername)
- ft_utils.execute_command(cmd)
+ @staticmethod
+ def run(name, noclean=False, report=False):
+ cmd = "run_tests {}-t {}".format(Tier.get_flags(noclean, report), name)
+ functest_utils.execute_command(cmd)
- def __init__(self):
- super(CliTier, self).__init__()
-
def list(self):
click.echo(super(CliTier, self).list())
def list(self):
click.echo(super(CliTier, self).list())
- def show(self, tiername):
- tier_info = super(CliTier, self).show(tiername)
+ def show(self, name):
+ tier_info = super(CliTier, self).show(name)
if tier_info:
click.echo(tier_info)
else:
tier_names = self.tiers.get_tier_names()
click.echo("The tier with name '%s' does not exist. "
if tier_info:
click.echo(tier_info)
else:
tier_names = self.tiers.get_tier_names()
click.echo("The tier with name '%s' does not exist. "
- "Available tiers are:\n %s\n" % (tiername, tier_names))
+ "Available tiers are:\n %s\n" % (name, tier_names))
- def gettests(self, tiername):
- tests = super(CliTier, self).gettests(tiername)
+ def gettests(self, name):
+ tests = super(CliTier, self).gettests(name)
- click.echo("Test cases in tier '%s':\n %s\n" % (tiername, tests))
+ click.echo("Test cases in tier '%s':\n %s\n" % (name, tests))
else:
tier_names = self.tiers.get_tier_names()
click.echo("The tier with name '%s' does not exist. "
else:
tier_names = self.tiers.get_tier_names()
click.echo("The tier with name '%s' does not exist. "
- "Available tiers are:\n %s\n" % (tiername, tier_names))
+ "Available tiers are:\n %s\n" % (name, tier_names))
from functest.utils.constants import CONST
from functest.utils.constants import CONST
-class RegexMatch(object):
+class RegexMatch(object): # pylint: disable=too-few-public-methods
def __init__(self, msg):
self.msg = msg
def __eq__(self, other):
match = re.search(self.msg, other)
def __init__(self, msg):
self.msg = msg
def __eq__(self, other):
match = re.search(self.msg, other)
- if match:
- return True
- return False
+ return match is not None
class CliEnvTesting(unittest.TestCase):
class CliEnvTesting(unittest.TestCase):
self.cli_environ = cli_env.CliEnv()
def _test_show_missing_env_var(self, var, *args):
self.cli_environ = cli_env.CliEnv()
def _test_show_missing_env_var(self, var, *args):
+ # pylint: disable=unused-argument
if var == 'INSTALLER_TYPE':
CONST.__setattr__('INSTALLER_TYPE', None)
if var == 'INSTALLER_TYPE':
CONST.__setattr__('INSTALLER_TYPE', None)
- reg_string = "| INSTALLER: Unknown, \S+\s*|"
+ reg_string = r"| INSTALLER: Unknown, \S+\s*|"
elif var == 'INSTALLER_IP':
CONST.__setattr__('INSTALLER_IP', None)
elif var == 'INSTALLER_IP':
CONST.__setattr__('INSTALLER_IP', None)
- reg_string = "| INSTALLER: \S+, Unknown\s*|"
+ reg_string = r"| INSTALLER: \S+, Unknown\s*|"
elif var == 'SCENARIO':
CONST.__setattr__('DEPLOY_SCENARIO', None)
elif var == 'SCENARIO':
CONST.__setattr__('DEPLOY_SCENARIO', None)
- reg_string = "| SCENARIO: Unknown\s*|"
+ reg_string = r"| SCENARIO: Unknown\s*|"
elif var == 'NODE':
CONST.__setattr__('NODE_NAME', None)
elif var == 'NODE':
CONST.__setattr__('NODE_NAME', None)
- reg_string = "| POD: Unknown\s*|"
+ reg_string = r"| POD: Unknown\s*|"
elif var == 'BUILD_TAG':
CONST.__setattr__('BUILD_TAG', None)
elif var == 'BUILD_TAG':
CONST.__setattr__('BUILD_TAG', None)
- reg_string = "| BUILD TAG: None|"
+ reg_string = r"| BUILD TAG: None|"
elif var == 'DEBUG':
CONST.__setattr__('CI_DEBUG', None)
elif var == 'DEBUG':
CONST.__setattr__('CI_DEBUG', None)
- reg_string = "| DEBUG FLAG: false\s*|"
+ reg_string = r"| DEBUG FLAG: false\s*|"
with mock.patch('functest.cli.commands.cli_env.click.echo') \
as mock_click_echo:
self.cli_environ.show()
mock_click_echo.assert_called_with(RegexMatch(reg_string))
with mock.patch('functest.cli.commands.cli_env.click.echo') \
as mock_click_echo:
self.cli_environ.show()
mock_click_echo.assert_called_with(RegexMatch(reg_string))
- def test_show_missing_ci_installer_type(self, *args):
+ def test_show_ci_installer_type_ko(self, *args):
self._test_show_missing_env_var('INSTALLER_TYPE', *args)
self._test_show_missing_env_var('INSTALLER_TYPE', *args)
- def test_show_missing_ci_installer_ip(self, *args):
+ def test_show_ci_installer_ip_ko(self, *args):
self._test_show_missing_env_var('INSTALLER_IP', *args)
def test_show_missing_ci_scenario(self, *args):
self._test_show_missing_env_var('INSTALLER_IP', *args)
def test_show_missing_ci_scenario(self, *args):
@mock.patch('functest.cli.commands.cli_os.exit', side_effect=Exception)
@mock.patch('functest.cli.commands.cli_os.click.echo')
@mock.patch('functest.cli.commands.cli_os.exit', side_effect=Exception)
@mock.patch('functest.cli.commands.cli_os.click.echo')
- def test_ping_endpoint_missing_auth_url(self, mock_click_echo,
- mock_exit):
+ def test_ping_endpoint_auth_url_ko(self, mock_click_echo, mock_exit):
with self.assertRaises(Exception):
self.cli_os.os_auth_url = None
self.cli_os.ping_endpoint()
with self.assertRaises(Exception):
self.cli_os.os_auth_url = None
self.cli_os.ping_endpoint()
- mock_click_echo.assert_called_once_with("Source the OpenStack "
- "credentials first '. "
- "$creds'")
+ mock_click_echo.assert_called_once_with(
+ "Source the OpenStack credentials first '. $creds'")
+ mock_exit.assert_called_once_with(0)
@mock.patch('functest.cli.commands.cli_os.exit')
@mock.patch('functest.cli.commands.cli_os.click.echo')
@mock.patch('functest.cli.commands.cli_os.exit')
@mock.patch('functest.cli.commands.cli_os.click.echo')
- def test_ping_endpoint_os_system_fails(self, mock_click_echo,
- mock_exit):
+ def test_ping_endpoint_system_fails(self, mock_click_echo, mock_exit):
self.cli_os.os_auth_url = self.os_auth_url
self.cli_os.endpoint_ip = self.endpoint_ip
with mock.patch('functest.cli.commands.cli_os.os.system',
return_value=1):
self.cli_os.ping_endpoint()
self.cli_os.os_auth_url = self.os_auth_url
self.cli_os.endpoint_ip = self.endpoint_ip
with mock.patch('functest.cli.commands.cli_os.os.system',
return_value=1):
self.cli_os.ping_endpoint()
- mock_click_echo.assert_called_once_with("Cannot talk to the "
- "endpoint %s\n" %
- self.endpoint_ip)
+ mock_click_echo.assert_called_once_with(
+ "Cannot talk to the endpoint %s\n" % self.endpoint_ip)
mock_exit.assert_called_once_with(0)
def test_check(self):
mock_exit.assert_called_once_with(0)
def test_check(self):
def setUp(self):
self.testname = 'testname'
def setUp(self):
self.testname = 'testname'
- with mock.patch('functest.cli.commands.cli_testcase.tb'):
+ with mock.patch('functest.ci.tier_builder'):
self.cli_tests = cli_testcase.CliTestcase()
self.cli_tests = cli_testcase.CliTestcase()
- @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_default(self, mock_ft_utils):
cmd = "run_tests -n -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
def test_run_default(self, mock_ft_utils):
cmd = "run_tests -n -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_noclean_missing_report(self, mock_ft_utils):
cmd = "run_tests -n -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
def test_run_noclean_missing_report(self, mock_ft_utils):
cmd = "run_tests -n -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_report_missing_noclean(self, mock_ft_utils):
cmd = "run_tests -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
def test_run_report_missing_noclean(self, mock_ft_utils):
cmd = "run_tests -r -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_missing_noclean_report(self, mock_ft_utils):
cmd = "run_tests -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=False)
def test_run_missing_noclean_report(self, mock_ft_utils):
cmd = "run_tests -t {}".format(self.testname)
self.cli_tests.run(self.testname, noclean=False, report=False)
def setUp(self):
self.tiername = 'tiername'
self.testnames = 'testnames'
def setUp(self):
self.tiername = 'tiername'
self.testnames = 'testnames'
- with mock.patch('functest.cli.commands.cli_tier.tb'):
+ with mock.patch('functest.ci.tier_builder'):
self.cli_tier = cli_tier.CliTier()
@mock.patch('functest.cli.commands.cli_tier.click.echo')
self.cli_tier = cli_tier.CliTier()
@mock.patch('functest.cli.commands.cli_tier.click.echo')
with mock.patch.object(self.cli_tier.tiers, 'get_tier',
return_value=mock_obj):
self.cli_tier.gettests(self.tiername)
with mock.patch.object(self.cli_tier.tiers, 'get_tier',
return_value=mock_obj):
self.cli_tier.gettests(self.tiername)
- mock_click_echo.assert_called_with("Test cases in tier "
- "'%s':\n %s\n" % (self.tiername,
- self.testnames
- ))
+ mock_click_echo.assert_called_with(
+ "Test cases in tier '%s':\n %s\n" % (
+ self.tiername, self.testnames))
@mock.patch('functest.cli.commands.cli_tier.click.echo')
def test_gettests_missing_tier(self, mock_click_echo):
@mock.patch('functest.cli.commands.cli_tier.click.echo')
def test_gettests_missing_tier(self, mock_click_echo):
":\n %s\n" % (self.tiername,
'tiernames'))
":\n %s\n" % (self.tiername,
'tiernames'))
- @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_default(self, mock_ft_utils):
cmd = "run_tests -n -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
def test_run_default(self, mock_ft_utils):
cmd = "run_tests -n -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=True)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_report_missing_noclean(self, mock_ft_utils):
cmd = "run_tests -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
def test_run_report_missing_noclean(self, mock_ft_utils):
cmd = "run_tests -r -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=True)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_noclean_missing_report(self, mock_ft_utils):
cmd = "run_tests -n -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
def test_run_noclean_missing_report(self, mock_ft_utils):
cmd = "run_tests -n -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=True, report=False)
mock_ft_utils.assert_called_with(cmd)
- @mock.patch('functest.cli.commands.cli_tier.ft_utils.execute_command')
+ @mock.patch('functest.utils.functest_utils.execute_command')
def test_run_missing_noclean_report(self, mock_ft_utils):
cmd = "run_tests -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=False)
def test_run_missing_noclean_report(self, mock_ft_utils):
cmd = "run_tests -t {}".format(self.tiername)
self.cli_tier.run(self.tiername, noclean=False, report=False)
def setUp(self):
self.runner = CliRunner()
def setUp(self):
self.runner = CliRunner()
- self._openstack = cli_base._openstack
- self._env = cli_base._env
- self._testcase = cli_base._testcase
- self._tier = cli_base._tier
+ self._openstack = cli_base.OPENSTACK
+ self._env = cli_base.ENV
+ self._testcase = cli_base.TESTCASE
+ self._tier = cli_base.TIER
def test_os_check(self):
with mock.patch.object(self._openstack, 'check') as mock_method:
def test_os_check(self):
with mock.patch.object(self._openstack, 'check') as mock_method:
modules =
functest.api
functest.ci
modules =
functest.api
functest.ci
functest.core
functest.energy
functest.opnfv_tests.sdn.odl
functest.tests.unit.ci
functest.core
functest.energy
functest.opnfv_tests.sdn.odl
functest.tests.unit.ci
+ functest.tests.unit.cli
functest.tests.unit.core
functest.tests.unit.energy
functest.tests.unit.odl
functest.tests.unit.core
functest.tests.unit.energy
functest.tests.unit.odl