Replace CONST.* by getattribute/setattr for rally and tempest
[functest.git] / functest / tests / unit / openstack / rally / test_rally.py
index fe25dfc..d55a825 100644 (file)
@@ -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()