diff options
18 files changed, 108 insertions, 108 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py index 4a47ba570..9166abe2c 100755 --- a/functest/ci/run_tests.py +++ b/functest/ci/run_tests.py @@ -138,7 +138,7 @@ def run_test(test, tier_name, testcases=None): if GlobalVariables.REPORT_FLAG: flags += " -r" - result = testcase_base.TestcaseBase.EX_RUN_ERROR + result = testcase_base.TestCase.EX_RUN_ERROR run_dict = get_run_dict(test_name) if run_dict: try: @@ -151,7 +151,7 @@ def run_test(test, tier_name, testcases=None): result = test_case.run(**kwargs) except KeyError: result = test_case.run() - if result == testcase_base.TestcaseBase.EX_OK: + if result == testcase_base.TestCase.EX_OK: if GlobalVariables.REPORT_FLAG: test_case.push_to_db() result = test_case.check_criteria() diff --git a/functest/core/feature_base.py b/functest/core/feature_base.py index 2bd1ec83d..9224d6c9a 100644 --- a/functest/core/feature_base.py +++ b/functest/core/feature_base.py @@ -6,7 +6,7 @@ import functest.utils.functest_logger as ft_logger from functest.utils.constants import CONST -class FeatureBase(base.TestcaseBase): +class FeatureBase(base.TestCase): def __init__(self, project='functest', case='', repo='', cmd=''): super(FeatureBase, self).__init__() @@ -26,7 +26,7 @@ class FeatureBase(base.TestcaseBase): self.parse_results(ret) self.log_results() self.logger.info("Test result is stored in '%s'" % self.result_file) - return base.TestcaseBase.EX_OK + return base.TestCase.EX_OK def execute(self): ''' @@ -42,13 +42,13 @@ class FeatureBase(base.TestcaseBase): pass def parse_results(self, ret): - exit_code = base.TestcaseBase.EX_OK + exit_code = base.TestCase.EX_OK if ret == 0: self.logger.info("{} OK".format(self.project_name)) self.criteria = 'PASS' else: self.logger.info("{} FAILED".format(self.project_name)) - exit_code = base.TestcaseBase.EX_RUN_ERROR + exit_code = base.TestCase.EX_RUN_ERROR self.criteria = "FAIL" return exit_code diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py index f0ae265a4..db60cefcd 100644 --- a/functest/core/pytest_suite_runner.py +++ b/functest/core/pytest_suite_runner.py @@ -10,7 +10,7 @@ import unittest import time -class PyTestSuiteRunner(base.TestcaseBase): +class PyTestSuiteRunner(base.TestCase): """ This superclass is designed to execute pre-configured unittest.TestSuite() objects @@ -42,9 +42,9 @@ class PyTestSuiteRunner(base.TestcaseBase): # a result can be PASS or FAIL # But in this case it means that the Execution was OK # we shall distinguish Execution Error from FAIL results - # TestcaseBase.EX_RUN_ERROR means that the test case was not run + # TestCase.EX_RUN_ERROR means that the test case was not run # not that it was run but the result was FAIL - exit_code = base.TestcaseBase.EX_OK + exit_code = base.TestCase.EX_OK if ((result.errors and len(result.errors) > 0) or (result.failures and len(result.failures) > 0)): self.logger.info("%s FAILED" % self.case_name) diff --git a/functest/core/testcase_base.py b/functest/core/testcase_base.py index 2848073f7..85d1fc746 100644 --- a/functest/core/testcase_base.py +++ b/functest/core/testcase_base.py @@ -13,7 +13,7 @@ import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils -class TestcaseBase(object): +class TestCase(object): EX_OK = os.EX_OK EX_RUN_ERROR = os.EX_SOFTWARE @@ -34,15 +34,15 @@ class TestcaseBase(object): try: assert self.criteria if self.criteria == 'PASS': - return TestcaseBase.EX_OK + return TestCase.EX_OK except AssertionError: self.logger.error("Please run test before checking the results") - return TestcaseBase.EX_TESTCASE_FAILED + return TestCase.EX_TESTCASE_FAILED def run(self, **kwargs): # pylint: disable=unused-argument self.logger.error("Run must be implemented") - return TestcaseBase.EX_RUN_ERROR + return TestCase.EX_RUN_ERROR def push_to_db(self): try: @@ -55,10 +55,10 @@ class TestcaseBase(object): self.project_name, self.case_name, self.start_time, self.stop_time, self.criteria, self.details): self.logger.info("The results were successfully pushed to DB") - return TestcaseBase.EX_OK + return TestCase.EX_OK else: self.logger.error("The results cannot be pushed to DB") - return TestcaseBase.EX_PUSH_TO_DB_ERROR + return TestCase.EX_PUSH_TO_DB_ERROR except Exception: # pylint: disable=broad-except self.logger.exception("The results cannot be pushed to DB") - return TestcaseBase.EX_PUSH_TO_DB_ERROR + return TestCase.EX_PUSH_TO_DB_ERROR diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py index f5e86054f..cd689c273 100644 --- a/functest/core/vnf_base.py +++ b/functest/core/vnf_base.py @@ -18,7 +18,7 @@ import testcase_base as base from functest.utils.constants import CONST -class VnfOnBoardingBase(base.TestcaseBase): +class VnfOnBoardingBase(base.TestCase): logger = ft_logger.Logger(__name__).getLogger() @@ -58,7 +58,7 @@ class VnfOnBoardingBase(base.TestcaseBase): except Exception: self.logger.error("Error during VNF Onboarding environment" + "creation", exc_info=True) - return base.TestcaseBase.EX_TESTCASE_FAILED + return base.TestCase.EX_TESTCASE_FAILED # Deploy orchestrator try: @@ -87,7 +87,7 @@ class VnfOnBoardingBase(base.TestcaseBase): vnf_ready_time - orchestrator_ready_time, 1) except Exception: self.logger.error("Error during VNF deployment", exc_info=True) - return base.TestcaseBase.EX_TESTCASE_FAILED + return base.TestCase.EX_TESTCASE_FAILED # Test VNF try: @@ -100,7 +100,7 @@ class VnfOnBoardingBase(base.TestcaseBase): test_vnf_done_time - vnf_ready_time, 1) except Exception: self.logger.error("Error when running VNF tests", exc_info=True) - return base.TestcaseBase.EX_TESTCASE_FAILED + return base.TestCase.EX_TESTCASE_FAILED # Clean the system self.clean() diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 46d6a5706..a45bc014f 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -26,7 +26,7 @@ import functest.utils.openstack_utils as os_utils logger = ft_logger.Logger('Rally').getLogger() -class RallyBase(testcase_base.TestcaseBase): +class RallyBase(testcase_base.TestCase): TESTS = ['authenticate', 'glance', 'cinder', 'heat', 'keystone', 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] GLANCE_IMAGE_NAME = CONST.openstack_image_name @@ -526,10 +526,10 @@ class RallyBase(testcase_base.TestcaseBase): self._run_tests() self._generate_report() self._clean_up() - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s' % e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR self.stop_time = time.time() return res diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 4312b7f9e..420c4ff93 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -23,7 +23,7 @@ import functest.utils.functest_utils as ft_utils logger = ft_logger.Logger("refstack_defcore").getLogger() -class RefstackClient(testcase_base.TestcaseBase): +class RefstackClient(testcase_base.TestCase): def __init__(self): super(RefstackClient, self).__init__() @@ -150,10 +150,10 @@ class RefstackClient(testcase_base.TestcaseBase): conf_utils.configure_tempest_defcore( self.DEPLOYMENT_DIR, img_flavor_dict) self.source_venv() - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except KeyError as e: logger.error("defcore prepare env error with: %s", e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR return res @@ -167,10 +167,10 @@ class RefstackClient(testcase_base.TestcaseBase): self.defcore_env_prepare() self.run_defcore_default() self.parse_refstack_result() - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s', e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR self.stop_time = time.time() return res @@ -187,15 +187,15 @@ class RefstackClient(testcase_base.TestcaseBase): openstack_utils.source_credentials(CONST.openstack_creds) self.defcore_env_prepare() self.run_defcore(tempestconf, testlist) - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s', e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR return res -class RefstackClientParser(testcase_base.TestcaseBase): +class RefstackClientParser(testcase_base.TestCase): def __init__(self): super(RefstackClientParser, self).__init__() @@ -228,7 +228,7 @@ if __name__ == '__main__': args = parser.parse_args(sys.argv[1:]) try: result = refstackclient.main(**args) - if result != testcase_base.TestcaseBase.EX_OK: + if result != testcase_base.TestCase.EX_OK: sys.exit(result) except Exception: - sys.exit(testcase_base.TestcaseBase.EX_RUN_ERROR) + sys.exit(testcase_base.TestCase.EX_RUN_ERROR) diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 54556a32f..d0119c9ad 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -26,7 +26,7 @@ import functest.utils.functest_utils as ft_utils logger = ft_logger.Logger("Tempest").getLogger() -class TempestCommon(testcase_base.TestcaseBase): +class TempestCommon(testcase_base.TestCase): def __init__(self): super(TempestCommon, self).__init__() @@ -223,10 +223,10 @@ class TempestCommon(testcase_base.TestcaseBase): self.apply_tempest_blacklist() self.run_verifier_tests() self.parse_verifier_result() - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s' % e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR self.stop_time = time.time() return res diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 9d57cfaea..9074c5fae 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -17,7 +17,7 @@ import functest.utils.openstack_utils as os_utils from functest.utils.constants import CONST -class VPingBase(testcase_base.TestcaseBase): +class VPingBase(testcase_base.TestCase): def __init__(self): super(VPingBase, self).__init__() self.logger = None @@ -52,23 +52,23 @@ class VPingBase(testcase_base.TestcaseBase): def run(self, **kwargs): if not self.check_repo_exist(): - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR image_id = self.create_image() if not image_id: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR flavor = self.get_flavor() if not flavor: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR network_id = self.create_network_full() if not network_id: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR sg_id = self.create_security_group() if not sg_id: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR self.delete_exist_vms() @@ -84,7 +84,7 @@ class VPingBase(testcase_base.TestcaseBase): None, sg_id) if not vm1: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR test_ip = self.get_test_ip(vm1) vm2 = self.boot_vm(self.vm2_name, @@ -94,17 +94,17 @@ class VPingBase(testcase_base.TestcaseBase): test_ip, sg_id) if not vm2: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR EXIT_CODE = self.do_vping(vm2, test_ip) - if EXIT_CODE == testcase_base.TestcaseBase.EX_RUN_ERROR: + if EXIT_CODE == testcase_base.TestCase.EX_RUN_ERROR: return EXIT_CODE self.stop_time = time.time() self.parse_result(EXIT_CODE, self.start_time, self.stop_time) - return testcase_base.TestcaseBase.EX_OK + return testcase_base.TestCase.EX_OK def boot_vm_preparation(self, config, vmname, test_ip): pass diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 7a58a41fa..b29f32694 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -32,12 +32,12 @@ class VPingSSH(vping_base.VPingBase): def do_vping(self, vm, test_ip): floatip = self.add_float_ip(vm) if not floatip: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR ssh = self.establish_ssh(vm, floatip) if not ssh: - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR if not self.transfer_ping_script(ssh, floatip): - return testcase_base.TestcaseBase.EX_RUN_ERROR + return testcase_base.TestCase.EX_RUN_ERROR return self.do_vping_ssh(ssh, test_ip) def add_float_ip(self, vm): diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index c8e9c4920..3d6be9a87 100755 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -46,7 +46,7 @@ class ODLResultVisitor(robot.api.ResultVisitor): return self._data -class ODLTests(testcase_base.TestcaseBase): +class ODLTests(testcase_base.TestCase): repos = "/home/opnfv/repos/" odl_test_repo = os.path.join(repos, "odl_test") @@ -59,7 +59,7 @@ class ODLTests(testcase_base.TestcaseBase): logger = ft_logger.Logger("opendaylight").getLogger() def __init__(self): - testcase_base.TestcaseBase.__init__(self) + testcase_base.TestCase.__init__(self) self.case_name = "odl" @classmethod @@ -236,9 +236,9 @@ if __name__ == '__main__': args = parser.parse_args(sys.argv[1:]) try: result = odl.main(ODLTests.default_suites, **args) - if result != testcase_base.TestcaseBase.EX_OK: + if result != testcase_base.TestCase.EX_OK: sys.exit(result) if args['pushtodb']: sys.exit(odl.push_to_db()) except Exception: - sys.exit(testcase_base.TestcaseBase.EX_RUN_ERROR) + sys.exit(testcase_base.TestCase.EX_RUN_ERROR) diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py index 8bc738325..5764bdee9 100644 --- a/functest/opnfv_tests/sdn/onos/onos.py +++ b/functest/opnfv_tests/sdn/onos/onos.py @@ -24,7 +24,7 @@ import functest.utils.openstack_utils as openstack_utils logger = ft_logger.Logger(__name__).getLogger() -class OnosBase(testcase_base.TestcaseBase): +class OnosBase(testcase_base.TestCase): onos_repo_path = CONST.dir_repo_onos onos_sfc_image_name = CONST.onos_sfc_image_name onos_sfc_image_path = os.path.join(CONST.dir_functest_data, @@ -39,10 +39,10 @@ class OnosBase(testcase_base.TestcaseBase): self.start_time = time.time() try: self._run() - res = testcase_base.TestcaseBase.EX_OK + res = testcase_base.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s', e) - res = testcase_base.TestcaseBase.EX_RUN_ERROR + res = testcase_base.TestCase.EX_RUN_ERROR self.stop_time = time.time() return res diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py index f1c265f47..8737924f8 100755 --- a/functest/opnfv_tests/vnf/aaa/aaa.py +++ b/functest/opnfv_tests/vnf/aaa/aaa.py @@ -62,9 +62,9 @@ if __name__ == '__main__': aaa_vnf = AaaVnf() try: result = aaa_vnf.main(**args) - if result != testcase_base.TestcaseBase.EX_OK: + if result != testcase_base.TestCase.EX_OK: sys.exit(result) if args['pushtodb']: sys.exit(aaa_vnf.push_to_db()) except Exception: - sys.exit(testcase_base.TestcaseBase.EX_RUN_ERROR) + sys.exit(testcase_base.TestCase.EX_RUN_ERROR) diff --git a/functest/tests/unit/core/test_testcase_base.py b/functest/tests/unit/core/test_testcase_base.py index 182da6ea3..a98caeadc 100644 --- a/functest/tests/unit/core/test_testcase_base.py +++ b/functest/tests/unit/core/test_testcase_base.py @@ -15,12 +15,12 @@ import mock from functest.core import testcase_base -class TestcaseBaseTesting(unittest.TestCase): +class TestCaseTesting(unittest.TestCase): logging.disable(logging.CRITICAL) def setUp(self): - self.test = testcase_base.TestcaseBase() + self.test = testcase_base.TestCase() self.test.project = "functest" self.test.case_name = "base" self.test.start_time = "1" @@ -30,13 +30,13 @@ class TestcaseBaseTesting(unittest.TestCase): def test_run_unimplemented(self): self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) @mock.patch('functest.utils.functest_utils.push_results_to_db', return_value=False) def _test_missing_attribute(self, mock_function=None): self.assertEqual(self.test.push_to_db(), - testcase_base.TestcaseBase.EX_PUSH_TO_DB_ERROR) + testcase_base.TestCase.EX_PUSH_TO_DB_ERROR) mock_function.assert_not_called() def test_missing_case_name(self): @@ -60,7 +60,7 @@ class TestcaseBaseTesting(unittest.TestCase): def test_missing_details(self, mock_function=None): self.test.details = None self.assertEqual(self.test.push_to_db(), - testcase_base.TestcaseBase.EX_OK) + testcase_base.TestCase.EX_OK) mock_function.assert_called_once_with( self.test.project, self.test.case_name, self.test.start_time, self.test.stop_time, self.test.criteria, self.test.details) @@ -69,7 +69,7 @@ class TestcaseBaseTesting(unittest.TestCase): return_value=False) def test_push_to_db_failed(self, mock_function=None): self.assertEqual(self.test.push_to_db(), - testcase_base.TestcaseBase.EX_PUSH_TO_DB_ERROR) + testcase_base.TestCase.EX_PUSH_TO_DB_ERROR) mock_function.assert_called_once_with( self.test.project, self.test.case_name, self.test.start_time, self.test.stop_time, self.test.criteria, self.test.details) @@ -78,7 +78,7 @@ class TestcaseBaseTesting(unittest.TestCase): return_value=True) def test_push_to_db(self, mock_function=None): self.assertEqual(self.test.push_to_db(), - testcase_base.TestcaseBase.EX_OK) + testcase_base.TestCase.EX_OK) mock_function.assert_called_once_with( self.test.project, self.test.case_name, self.test.start_time, self.test.stop_time, self.test.criteria, self.test.details) @@ -86,17 +86,17 @@ class TestcaseBaseTesting(unittest.TestCase): def test_check_criteria_missing(self): self.test.criteria = None self.assertEqual(self.test.check_criteria(), - testcase_base.TestcaseBase.EX_TESTCASE_FAILED) + testcase_base.TestCase.EX_TESTCASE_FAILED) def test_check_criteria_failed(self): self.test.criteria = 'FAILED' self.assertEqual(self.test.check_criteria(), - testcase_base.TestcaseBase.EX_TESTCASE_FAILED) + testcase_base.TestCase.EX_TESTCASE_FAILED) def test_check_criteria_pass(self): self.test.criteria = 'PASS' self.assertEqual(self.test.check_criteria(), - testcase_base.TestcaseBase.EX_OK) + testcase_base.TestCase.EX_OK) if __name__ == "__main__": diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 5961940f1..fc5c8b684 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -202,7 +202,7 @@ class ODLTesting(unittest.TestCase): def _test_main_missing_keyword(self, key): kwargs = self._get_main_kwargs(key) self.assertEqual(self.test.main(**kwargs), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_main_missing_odlusername(self): self._test_main_missing_keyword('odlusername') @@ -237,7 +237,7 @@ class ODLTesting(unittest.TestCase): def test_main_set_robotframework_vars_failed(self): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=False): - self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR) + self._test_main(testcase_base.TestCase.EX_RUN_ERROR) self.test.set_robotframework_vars.assert_called_once_with( self._odl_username, self._odl_password) @@ -246,14 +246,14 @@ class ODLTesting(unittest.TestCase): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ self.assertRaises(Exception): - self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, + self._test_main(testcase_base.TestCase.EX_RUN_ERROR, mock_method) @mock.patch('os.makedirs', side_effect=OSError) def test_main_makedirs_oserror(self, mock_method): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True): - self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, + self._test_main(testcase_base.TestCase.EX_RUN_ERROR, mock_method) @mock.patch('robot.run', side_effect=RobotError) @@ -264,7 +264,7 @@ class ODLTesting(unittest.TestCase): mock.patch.object(odl, 'open', mock.mock_open(), create=True), \ self.assertRaises(RobotError): - self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args) + self._test_main(testcase_base.TestCase.EX_RUN_ERROR, *args) @mock.patch('robot.run') @mock.patch('os.makedirs') @@ -275,7 +275,7 @@ class ODLTesting(unittest.TestCase): create=True), \ mock.patch.object(self.test, 'parse_results', side_effect=RobotError): - self._test_main(testcase_base.TestcaseBase.EX_RUN_ERROR, *args) + self._test_main(testcase_base.TestCase.EX_RUN_ERROR, *args) @mock.patch('os.remove', side_effect=Exception) @mock.patch('robot.run') @@ -285,7 +285,7 @@ class ODLTesting(unittest.TestCase): return_value=True), \ mock.patch.object(self.test, 'parse_results'), \ self.assertRaises(Exception): - self._test_main(testcase_base.TestcaseBase.EX_OK, *args) + self._test_main(testcase_base.TestCase.EX_OK, *args) @mock.patch('os.remove') @mock.patch('robot.run') @@ -296,7 +296,7 @@ class ODLTesting(unittest.TestCase): mock.patch.object(odl, 'open', mock.mock_open(), create=True), \ mock.patch.object(self.test, 'parse_results'): - self._test_main(testcase_base.TestcaseBase.EX_OK, *args) + self._test_main(testcase_base.TestCase.EX_OK, *args) @mock.patch('os.remove') @mock.patch('robot.run') @@ -307,7 +307,7 @@ class ODLTesting(unittest.TestCase): mock.patch.object(odl, 'open', mock.mock_open(), create=True), \ mock.patch.object(self.test, 'parse_results'): - self._test_main(testcase_base.TestcaseBase.EX_OK, *args) + self._test_main(testcase_base.TestCase.EX_OK, *args) @mock.patch('os.remove') @mock.patch('robot.run', return_value=1) @@ -318,7 +318,7 @@ class ODLTesting(unittest.TestCase): mock.patch.object(odl, 'open', mock.mock_open(), create=True), \ mock.patch.object(self.test, 'parse_results'): - self._test_main(testcase_base.TestcaseBase.EX_OK, *args) + self._test_main(testcase_base.TestCase.EX_OK, *args) @mock.patch('os.remove', side_effect=OSError) @mock.patch('robot.run') @@ -329,16 +329,16 @@ class ODLTesting(unittest.TestCase): mock.patch.object(odl, 'open', mock.mock_open(), create=True), \ mock.patch.object(self.test, 'parse_results'): - self._test_main(testcase_base.TestcaseBase.EX_OK, *args) + self._test_main(testcase_base.TestCase.EX_OK, *args) def _test_run_missing_env_var(self, var): with mock.patch('functest.utils.openstack_utils.get_endpoint', side_effect=self._fake_url_for): del os.environ[var] self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) - def _test_run(self, status=testcase_base.TestcaseBase.EX_OK, + def _test_run(self, status=testcase_base.TestCase.EX_OK, exception=None, odlip="127.0.0.3", odlwebport="8080", odlrestconfport="8181"): with mock.patch('functest.utils.openstack_utils.get_endpoint', @@ -360,7 +360,7 @@ class ODLTesting(unittest.TestCase): def _test_run_defining_multiple_suites( self, suites, - status=testcase_base.TestcaseBase.EX_OK, + status=testcase_base.TestCase.EX_OK, exception=None, odlip="127.0.0.3", odlwebport="8080", odlrestconfport="8181"): with mock.patch('functest.utils.openstack_utils.get_endpoint', @@ -384,7 +384,7 @@ class ODLTesting(unittest.TestCase): with mock.patch('functest.utils.openstack_utils.get_endpoint', side_effect=auth_plugins.MissingAuthPlugin()): self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_run_missing_os_auth_url(self): self._test_run_missing_env_var("OS_AUTH_URL") @@ -400,14 +400,14 @@ class ODLTesting(unittest.TestCase): def test_run_main_false(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip - self._test_run(testcase_base.TestcaseBase.EX_RUN_ERROR, + self._test_run(testcase_base.TestCase.EX_RUN_ERROR, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_run_main_exception(self): with self.assertRaises(Exception): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip - self._test_run(status=testcase_base.TestcaseBase.EX_RUN_ERROR, + self._test_run(status=testcase_base.TestCase.EX_RUN_ERROR, exception=Exception(), odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) @@ -416,11 +416,11 @@ class ODLTesting(unittest.TestCase): with mock.patch('functest.utils.openstack_utils.get_endpoint', side_effect=self._fake_url_for): self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_run_without_installer_type(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) @@ -428,13 +428,13 @@ class ODLTesting(unittest.TestCase): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_run_defining_multiple_suites( [odl.ODLTests.basic_suite_dir], - testcase_base.TestcaseBase.EX_OK, + testcase_base.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) def test_run_fuel(self): os.environ["INSTALLER_TYPE"] = "fuel" - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._neutron_ip, odlwebport='8282') def test_run_apex_missing_sdn_controller_ip(self): @@ -442,12 +442,12 @@ class ODLTesting(unittest.TestCase): side_effect=self._fake_url_for): os.environ["INSTALLER_TYPE"] = "apex" self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_run_apex(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "apex" - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8081', odlrestconfport='8081') @@ -456,12 +456,12 @@ class ODLTesting(unittest.TestCase): side_effect=self._fake_url_for): os.environ["INSTALLER_TYPE"] = "netvirt" self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_run_netvirt(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "netvirt" - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8081', odlrestconfport='8081') @@ -470,17 +470,17 @@ class ODLTesting(unittest.TestCase): side_effect=self._fake_url_for): os.environ["INSTALLER_TYPE"] = "joid" self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_run_joid(self): os.environ["SDN_CONTROLLER"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "joid" - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8080') def test_run_compass(self, *args): os.environ["INSTALLER_TYPE"] = "compass" - self._test_run(testcase_base.TestcaseBase.EX_OK, + self._test_run(testcase_base.TestCase.EX_OK, odlip=self._neutron_ip, odlwebport='8181') def test_argparser_default(self): diff --git a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py b/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py index ad39be48c..99e14b85e 100644 --- a/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py +++ b/functest/tests/unit/opnfv_tests/openstack/rally/test_rally.py @@ -378,13 +378,13 @@ class OSRallyTesting(unittest.TestCase): mock.patch.object(self.rally_base, '_generate_report'), \ mock.patch.object(self.rally_base, '_clean_up'): self.assertEqual(self.rally_base.run(), - testcase_base.TestcaseBase.EX_OK) + testcase_base.TestCase.EX_OK) def test_run_exception(self): with mock.patch.object(self.rally_base, '_prepare_env', side_effect=Exception): self.assertEqual(self.rally_base.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) if __name__ == "__main__": diff --git a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py b/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py index 4e83f6bf3..4035b9c30 100644 --- a/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py +++ b/functest/tests/unit/opnfv_tests/openstack/refstack_client/test_refstack_client.py @@ -70,7 +70,7 @@ class OSRefstackClientTesting(unittest.TestCase): def _test_main_missing_keyword(self, key): kwargs = self._get_main_kwargs(key) self.assertEqual(self.refstackclient.main(**kwargs), - testcase_base.TestcaseBase.EX_RUN_ERROR) + testcase_base.TestCase.EX_RUN_ERROR) def test_main_missing_conf(self): self._test_main_missing_keyword('config') diff --git a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py index 856cd1434..56864b534 100644 --- a/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py +++ b/functest/tests/unit/opnfv_tests/openstack/tempest/test_tempest.py @@ -119,7 +119,7 @@ class OSTempestTesting(unittest.TestCase): mock_method.assert_any_call('test_case_name', 100) def test_run_missing_create_tempest_dir(self): - ret = testcase_base.TestcaseBase.EX_RUN_ERROR + ret = testcase_base.TestCase.EX_RUN_ERROR with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' @@ -132,8 +132,8 @@ class OSTempestTesting(unittest.TestCase): self.assertTrue(mock_os_makedirs.called) def test_run_missing_configure_tempest(self): - ret = testcase_base.TestcaseBase.EX_RUN_ERROR - ret_ok = testcase_base.TestcaseBase.EX_OK + ret = testcase_base.TestCase.EX_RUN_ERROR + ret_ok = testcase_base.TestCase.EX_OK with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' @@ -149,8 +149,8 @@ class OSTempestTesting(unittest.TestCase): self.assertTrue(mock_os_makedirs.called) def test_run_missing_generate_test_list(self): - ret = testcase_base.TestcaseBase.EX_RUN_ERROR - ret_ok = testcase_base.TestcaseBase.EX_OK + ret = testcase_base.TestCase.EX_RUN_ERROR + ret_ok = testcase_base.TestCase.EX_OK with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' @@ -168,8 +168,8 @@ class OSTempestTesting(unittest.TestCase): self.assertTrue(mock_os_makedirs.called) def test_run_missing_apply_tempest_blacklist(self): - ret = testcase_base.TestcaseBase.EX_RUN_ERROR - ret_ok = testcase_base.TestcaseBase.EX_OK + ret = testcase_base.TestCase.EX_RUN_ERROR + ret_ok = testcase_base.TestCase.EX_OK with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' @@ -189,8 +189,8 @@ class OSTempestTesting(unittest.TestCase): self.assertTrue(mock_os_makedirs.called) def test_run_missing_parse_verifier_result(self): - ret = testcase_base.TestcaseBase.EX_RUN_ERROR - ret_ok = testcase_base.TestcaseBase.EX_OK + ret = testcase_base.TestCase.EX_RUN_ERROR + ret_ok = testcase_base.TestCase.EX_OK with mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' 'os.path.exists', return_value=False), \ mock.patch('functest.opnfv_tests.openstack.tempest.tempest.' |