aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-12 10:40:07 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-12 10:40:07 +0100
commit8d83b91049f4b2f3da6b77d39105a2213a8ce690 (patch)
treefda59bceab55bb72a9f7cf7318acb471be5f7d29 /functest/tests/unit
parentafd36ed11701273fd70843082ca2af593e82ccd8 (diff)
Export env vars via os.environ in test_cli_env.py
CONST shouldn't be used for getting/setting env vars. It adds complexity and may raise side effects. Change-Id: Id80a03aff6eb908a792f1d07addaad4770e8d0cb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/cli/commands/test_cli_env.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/functest/tests/unit/cli/commands/test_cli_env.py b/functest/tests/unit/cli/commands/test_cli_env.py
index e5c409bf..88377234 100644
--- a/functest/tests/unit/cli/commands/test_cli_env.py
+++ b/functest/tests/unit/cli/commands/test_cli_env.py
@@ -8,13 +8,13 @@
# pylint: disable=missing-docstring
import logging
+import os
import re
import unittest
import mock
from functest.cli.commands import cli_env
-from functest.utils.constants import CONST
class RegexMatch(object): # pylint: disable=too-few-public-methods
@@ -34,22 +34,22 @@ class CliEnvTesting(unittest.TestCase):
def _test_show_missing_env_var(self, var, *args):
# pylint: disable=unused-argument
if var == 'INSTALLER_TYPE':
- CONST.__setattr__('INSTALLER_TYPE', None)
+ os.environ['INSTALLER_TYPE'] = ''
reg_string = r"| INSTALLER: Unknown, \S+\s*|"
elif var == 'INSTALLER_IP':
- CONST.__setattr__('INSTALLER_IP', None)
+ os.environ['INSTALLER_IP'] = ''
reg_string = r"| INSTALLER: \S+, Unknown\s*|"
elif var == 'SCENARIO':
- CONST.__setattr__('DEPLOY_SCENARIO', None)
+ os.environ['DEPLOY_SCENARIO'] = ''
reg_string = r"| SCENARIO: Unknown\s*|"
elif var == 'NODE':
- CONST.__setattr__('NODE_NAME', None)
+ os.environ['NODE_NAME'] = ''
reg_string = r"| POD: Unknown\s*|"
elif var == 'BUILD_TAG':
- CONST.__setattr__('BUILD_TAG', None)
+ os.environ['BUILD_TAG'] = ''
reg_string = r"| BUILD TAG: None|"
elif var == 'DEBUG':
- CONST.__setattr__('CI_DEBUG', None)
+ os.environ['CI_DEBUG'] = ''
reg_string = r"| DEBUG FLAG: false\s*|"
with mock.patch('functest.cli.commands.cli_env.click.echo') \