diff options
author | Juha Kosonen <juha.kosonen@nokia.com> | 2018-02-13 14:08:58 +0200 |
---|---|---|
committer | Juha Kosonen <juha.kosonen@nokia.com> | 2018-02-13 14:08:58 +0200 |
commit | 2f67e870b37683f01ac738a39f3f6859506dd0a7 (patch) | |
tree | 78afea9bdc43ca89eff6b8b99ccd1f6844392d00 /functest/tests/unit/openstack/rally | |
parent | b1522c34d95f9bb48fc9cfca91f281da2f958953 (diff) |
Enhance variable manipulation in rally
- utilize env vars directly via os module
- use getattr to read CONST
JIRA: FUNCTEST-931
Change-Id: I893a91331e26846f8effe2d3d58522950bd096fd
Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
Diffstat (limited to 'functest/tests/unit/openstack/rally')
-rw-r--r-- | functest/tests/unit/openstack/rally/test_rally.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index 08ca7e39..9cc6bf53 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -16,7 +16,6 @@ import mock from functest.core import testcase from functest.opnfv_tests.openstack.rally import rally -from functest.utils.constants import CONST from snaps.openstack.os_credentials import OSCreds @@ -34,13 +33,13 @@ class OSRallyTesting(unittest.TestCase): self.assertTrue(mock_get_creds.called) def test_build_task_args_missing_floating_network(self): - CONST.__setattr__('OS_AUTH_URL', None) + os.environ['OS_AUTH_URL'] = '' self.rally_base.ext_net_name = '' task_args = self.rally_base._build_task_args('test_file_name') self.assertEqual(task_args['floating_network'], '') def test_build_task_args_missing_net_id(self): - CONST.__setattr__('OS_AUTH_URL', None) + os.environ['OS_AUTH_URL'] = '' self.rally_base.priv_net_id = '' task_args = self.rally_base._build_task_args('test_file_name') self.assertEqual(task_args['netid'], '') @@ -121,8 +120,8 @@ class OSRallyTesting(unittest.TestCase): 'installers': ['test_installer'], 'tests': ['other_test']}]}) def test_excl_scenario_default(self, mock_func): - CONST.__setattr__('INSTALLER_TYPE', 'test_installer') - CONST.__setattr__('DEPLOY_SCENARIO', 'test_scenario') + os.environ['INSTALLER_TYPE'] = 'test_installer' + os.environ['DEPLOY_SCENARIO'] = 'test_scenario' self.assertEqual(self.rally_base.excl_scenario(), ['test']) mock_func.assert_called() @@ -148,8 +147,8 @@ class OSRallyTesting(unittest.TestCase): 'installers': ['test_installer'], 'tests': ['test0b']}]}) def test_excl_scenario_regex(self, mock_func): - CONST.__setattr__('INSTALLER_TYPE', 'test_installer') - CONST.__setattr__('DEPLOY_SCENARIO', 'os-ctrlT-featT-modeT') + os.environ['INSTALLER_TYPE'] = 'test_installer' + os.environ['DEPLOY_SCENARIO'] = 'os-ctrlT-featT-modeT' self.assertEqual(self.rally_base.excl_scenario(), ['test1', 'test2', 'test3', 'test4']) mock_func.assert_called() @@ -166,8 +165,8 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_migration_supported', return_value=False) def test_excl_func_default(self, mock_func, mock_yaml_load): - CONST.__setattr__('INSTALLER_TYPE', 'test_installer') - CONST.__setattr__('DEPLOY_SCENARIO', 'test_scenario') + os.environ['INSTALLER_TYPE'] = 'test_installer' + os.environ['DEPLOY_SCENARIO'] = 'test_scenario' self.assertEqual(self.rally_base.excl_func(), ['test']) mock_func.assert_called() mock_yaml_load.assert_called() |