From d55207785fc615c5236bf204a583285882b0672f Mon Sep 17 00:00:00 2001 From: Linda Wang Date: Thu, 18 May 2017 07:17:27 +0000 Subject: Replace CONST.* by getattribute/setattr for rally and tempest Directories affected: - functest/opnfv_tests/openstack/rally - functest/opnfv_tests/openstack/tempest and respective unit test JIRA: FUNCTEST-796 Change-Id: I963f5947663f0b660337f3304defb697f5d338f3 Signed-off-by: Linda Wang --- functest/tests/unit/openstack/rally/test_rally.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'functest/tests/unit/openstack/rally') diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index c7828618..d55a825d 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -39,7 +39,7 @@ class OSRallyTesting(unittest.TestCase): self.polling_iter = 2 def test_build_task_args_missing_floating_network(self): - CONST.OS_AUTH_URL = None + CONST.__setattr__('OS_AUTH_URL', None) with mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_external_net', return_value=None): @@ -47,7 +47,7 @@ class OSRallyTesting(unittest.TestCase): self.assertEqual(task_args['floating_network'], '') def test_build_task_args_missing_net_id(self): - CONST.OS_AUTH_URL = None + CONST.__setattr__('OS_AUTH_URL', None) self.rally_base.network_dict['net_id'] = '' with mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_external_net', @@ -56,7 +56,7 @@ class OSRallyTesting(unittest.TestCase): self.assertEqual(task_args['netid'], '') def test_build_task_args_missing_auth_url(self): - CONST.OS_AUTH_URL = None + CONST.__setattr__('OS_AUTH_URL', None) with mock.patch('functest.opnfv_tests.openstack.rally.rally.' 'os_utils.get_external_net', return_value='test_floating_network'): @@ -136,8 +136,8 @@ class OSRallyTesting(unittest.TestCase): 'lineline') def test_excl_scenario_default(self): - CONST.INSTALLER_TYPE = 'test_installer' - CONST.DEPLOY_SCENARIO = 'test_scenario' + CONST.__setattr__('INSTALLER_TYPE', 'test_installer') + CONST.__setattr__('DEPLOY_SCENARIO', 'test_scenario') dic = {'scenario': [{'scenarios': ['test_scenario'], 'installers': ['test_installer'], 'tests': ['test']}]} @@ -154,8 +154,8 @@ class OSRallyTesting(unittest.TestCase): []) def test_excl_func_default(self): - CONST.INSTALLER_TYPE = 'test_installer' - CONST.DEPLOY_SCENARIO = 'test_scenario' + CONST.__setattr__('INSTALLER_TYPE', 'test_installer') + CONST.__setattr__('DEPLOY_SCENARIO', 'test_scenario') dic = {'functionality': [{'functions': ['no_live_migration'], 'tests': ['test']}]} with mock.patch('__builtin__.open', mock.mock_open()), \ -- cgit 1.2.3-korg