X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Ftests%2Funit%2Fcli%2Fcommands%2Ftest_cli_env.py;h=c3d89ea3ae68a45bafc529ed31670c99fc569551;hb=refs%2Fchanges%2F55%2F34955%2F1;hp=f70761dcdf0dd51aad5d1f4f124fecb00a48a082;hpb=9bc652fe41541a05f52c09d01a2e671eae5b2965;p=functest.git diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py index f70761dcd..c3d89ea3a 100644 --- a/functest/tests/unit/cli/commands/test_cli_env.py +++ b/functest/tests/unit/cli/commands/test_cli_env.py @@ -11,7 +11,6 @@ import unittest from git.exc import NoSuchPathError import mock -mock.patch('logging.FileHandler').start() # noqa from functest.cli.commands import cli_env from functest.utils.constants import CONST from functest.tests.unit import test_utils @@ -29,7 +28,7 @@ class CliEnvTesting(unittest.TestCase): @mock.patch('functest.cli.commands.cli_testcase.ft_utils.execute_command') def test_prepare_default(self, mock_ft_utils, mock_os): cmd = ("python %s/functest/ci/prepare_env.py start" % - CONST.dir_repo_functest) + CONST.__getattribute__('dir_repo_functest')) self.cli_environ.prepare() mock_ft_utils.assert_called_with(cmd) @@ -41,29 +40,30 @@ class CliEnvTesting(unittest.TestCase): mock.patch('functest.cli.commands.cli_testcase.os.remove') \ as mock_os_remove: cmd = ("python %s/functest/ci/prepare_env.py start" % - CONST.dir_repo_functest) + CONST.__getattribute__('dir_repo_functest')) self.cli_environ.prepare() - mock_os_remove.assert_called_once_with(CONST.env_active) + mock_os_remove.assert_called_once_with( + CONST.__getattribute__('env_active')) mock_ft_utils.assert_called_with(cmd) def _test_show_missing_env_var(self, var, *args): if var == 'INSTALLER_TYPE': - CONST.INSTALLER_TYPE = None + CONST.__setattr__('INSTALLER_TYPE', None) reg_string = "| INSTALLER: Unknown, \S+\s*|" elif var == 'INSTALLER_IP': - CONST.INSTALLER_IP = None + CONST.__setattr__('INSTALLER_IP', None) reg_string = "| INSTALLER: \S+, Unknown\s*|" elif var == 'SCENARIO': - CONST.DEPLOY_SCENARIO = None + CONST.__setattr__('DEPLOY_SCENARIO', None) reg_string = "| SCENARIO: Unknown\s*|" elif var == 'NODE': - CONST.NODE_NAME = None + CONST.__setattr__('NODE_NAME', None) reg_string = "| POD: Unknown\s*|" elif var == 'BUILD_TAG': - CONST.BUILD_TAG = None + CONST.__setattr__('BUILD_TAG', None) reg_string = "| BUILD TAG: None|" elif var == 'DEBUG': - CONST.CI_DEBUG = None + CONST.__setattr__('CI_DEBUG', None) reg_string = "| DEBUG FLAG: false\s*|" elif var == 'STATUS': reg_string = "| STATUS: not ready\s*|" @@ -107,7 +107,7 @@ class CliEnvTesting(unittest.TestCase): @mock.patch('functest.cli.commands.cli_env.os.path.exists', return_value=False) def test_show_missing_git_repo_dir(self, *args): - CONST.dir_repo_functest = None + CONST.__setattr__('dir_repo_functest', None) self.assertRaises(NoSuchPathError, lambda: self.cli_environ.show()) @mock.patch('functest.cli.commands.cli_env.click.echo')