X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Ftests%2Funit%2Fopenstack%2Frally%2Ftest_rally.py;h=d55a825ddcc424c9e3e7cebc2c7dab58b37adafa;hb=d55207785fc615c5236bf204a583285882b0672f;hp=fe25dfcf935effcddf4c35761c58c81789a3232c;hpb=35473374d1eba4814b8344d094e62210ef17d9b1;p=functest.git diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index fe25dfcf9..d55a825dd 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()), \ @@ -343,19 +343,6 @@ class OSRallyTesting(unittest.TestCase): self.rally_base._run_tests() self.rally_base._run_task.assert_any_call('test1') - @mock.patch('functest.opnfv_tests.openstack.rally.rally.logger.info') - def test_generate_report(self, mock_logger_info): - summary = [{'test_name': 'test_name', - 'overall_duration': 5, - 'nb_tests': 3, - 'success': 5}] - self.rally_base.summary = summary - with mock.patch('functest.opnfv_tests.openstack.rally.rally.' - 'ft_utils.check_success_rate', - return_value='criteria'): - self.rally_base._generate_report() - self.assertTrue(mock_logger_info.called) - def test_clean_up_default(self): self.rally_base.volume_type = mock.Mock() self.rally_base.cinder_client = mock.Mock()