diff options
Diffstat (limited to 'functest/tests/unit/odl/test_odl.py')
-rw-r--r-- | functest/tests/unit/odl/test_odl.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index 065298d6..46707e82 100644 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -16,11 +16,11 @@ import unittest from robot.errors import RobotError from functest.core import TestCasesBase -from functest.opnfv_tests.Controllers.ODL import OpenDaylightTesting +from functest.opnfv_tests.sdn.odl import odl from functest.utils import functest_constants as ft_constants -class ODLTestCasesTesting(unittest.TestCase): +class ODLTesting(unittest.TestCase): logging.disable(logging.CRITICAL) @@ -39,7 +39,7 @@ class ODLTestCasesTesting(unittest.TestCase): ft_constants.OS_USERNAME = self._os_username ft_constants.OS_PASSWORD = self._os_password ft_constants.OS_TENANT_NAME = self._os_tenantname - self.test = OpenDaylightTesting.ODLTestCases() + self.test = odl.ODLTests() @mock.patch('fileinput.input', side_effect=Exception()) def test_set_robotframework_vars_failed(self, *args): @@ -53,9 +53,9 @@ class ODLTestCasesTesting(unittest.TestCase): def _fake_url_for(cls, service_type='identity', **kwargs): if service_type == 'identity': return "http://{}:5000/v2.0".format( - ODLTestCasesTesting._keystone_ip) + ODLTesting._keystone_ip) elif service_type == 'network': - return "http://{}:9696".format(ODLTestCasesTesting._neutron_ip) + return "http://{}:9696".format(ODLTesting._neutron_ip) else: return None @@ -85,7 +85,7 @@ class ODLTestCasesTesting(unittest.TestCase): def _test_main(self, status, *args): kwargs = self._get_main_kwargs() self.assertEqual(self.test.main(**kwargs), status) - odl_res_dir = OpenDaylightTesting.ODLTestCases.res_dir + odl_res_dir = odl.ODLTests.res_dir if len(args) > 0: args[0].assert_called_once_with(odl_res_dir) if len(args) > 1: @@ -99,8 +99,8 @@ class ODLTestCasesTesting(unittest.TestCase): 'RESTCONFPORT:{}'.format(self._odl_restconfport)] output_file = os.path.join(odl_res_dir, 'output.xml') args[1].assert_called_once_with( - OpenDaylightTesting.ODLTestCases.basic_suite_dir, - OpenDaylightTesting.ODLTestCases.neutron_suite_dir, + odl.ODLTests.basic_suite_dir, + odl.ODLTests.neutron_suite_dir, log='NONE', output=output_file, report='NONE', @@ -200,7 +200,8 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'parse_results'): + mock.patch.object(self.test, 'parse_results', + return_value="PASS"): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @mock.patch('os.remove') @@ -209,7 +210,8 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main_makedirs_oserror17(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'parse_results'): + mock.patch.object(self.test, 'parse_results', + return_value="PASS"): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @mock.patch('os.remove') @@ -218,7 +220,8 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main_testcases_in_failure(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'parse_results'): + mock.patch.object(self.test, 'parse_results', + return_value="PASS"): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @mock.patch('os.remove', side_effect=OSError) @@ -227,7 +230,8 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main_remove_oserror(self, *args): with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'parse_results'): + mock.patch.object(self.test, 'parse_results', + return_value="PASS"): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) def _test_run_missing_env_var(self, var): |