diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-14 16:02:53 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-16 10:24:22 +0100 |
commit | d589e4e5345ed82c68d9a011ac89f8cdbefe2ca3 (patch) | |
tree | 1ec221f1f95e6abaec9b1465e9e46b76f8777a27 /functest/tests/unit/openstack | |
parent | 98e2806cb674d206dea65647c0644dc5b2871b4b (diff) |
Get properly env vars or their default values
It defines env.get() as an unique way to get Functest env vars or
their default values. It can be considered as a wrapper above os.environ.
It enforces backward compatibility via CONST which mustn't be used
for that purpose. It should be noted that it also stops using CONST
for getting OpenStack env vars.
Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/tests/unit/openstack')
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_tempest.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/functest/tests/unit/openstack/tempest/test_tempest.py b/functest/tests/unit/openstack/tempest/test_tempest.py index 5d543ffc..060a8a01 100644 --- a/functest/tests/unit/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/openstack/tempest/test_tempest.py @@ -8,6 +8,7 @@ # pylint: disable=missing-docstring import logging +import os import unittest import mock @@ -15,7 +16,6 @@ import mock from functest.core import testcase from functest.opnfv_tests.openstack.tempest import tempest from functest.opnfv_tests.openstack.tempest import conf_utils -from functest.utils.constants import CONST from snaps.openstack.os_credentials import OSCreds @@ -115,8 +115,8 @@ class OSTempestTesting(unittest.TestCase): mock.patch.object(self.tempestcommon, 'read_file', return_value=['test1', 'test2']): conf_utils.TEMPEST_BLACKLIST = Exception - CONST.__setattr__('INSTALLER_TYPE', 'installer_type') - CONST.__setattr__('DEPLOY_SCENARIO', 'deploy_scenario') + os.environ['INSTALLER_TYPE'] = 'installer_type' + os.environ['DEPLOY_SCENARIO'] = 'deploy_scenario' self.tempestcommon.apply_tempest_blacklist() obj = mock_open() obj.write.assert_any_call('test1\n') @@ -131,8 +131,8 @@ class OSTempestTesting(unittest.TestCase): return_value=['test1', 'test2']), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'yaml.safe_load', return_value=item_dict): - CONST.__setattr__('INSTALLER_TYPE', 'installer_type') - CONST.__setattr__('DEPLOY_SCENARIO', 'deploy_scenario') + os.environ['INSTALLER_TYPE'] = 'installer_type' + os.environ['DEPLOY_SCENARIO'] = 'deploy_scenario' self.tempestcommon.apply_tempest_blacklist() obj = mock_open() obj.write.assert_any_call('test1\n') |