diff options
-rwxr-xr-x | testcases/Controllers/ODL/OpenDaylightTesting.py | 17 | ||||
-rw-r--r-- | testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot | 30 | ||||
-rw-r--r-- | unit_tests/odl/test_odl.py | 65 |
3 files changed, 14 insertions, 98 deletions
diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/testcases/Controllers/ODL/OpenDaylightTesting.py index c44be626..8c003abf 100755 --- a/testcases/Controllers/ODL/OpenDaylightTesting.py +++ b/testcases/Controllers/ODL/OpenDaylightTesting.py @@ -12,7 +12,6 @@ import errno import fileinput import os import re -import shutil import sys import urlparse @@ -60,19 +59,6 @@ class ODLTestCases(TestCasesBase.TestCasesBase): self.case_name = "odl" @classmethod - def copy_opnf_testcases(cls): - opnfv_testcases_dir = (os.path.dirname(os.path.abspath(__file__)) + - "/custom_tests/neutron/") - f = opnfv_testcases_dir + "001__reachability.robot" - try: - shutil.copy(f, cls.neutron_suite_dir) - except IOError as e: - cls.logger.error( - "Cannot copy OPNFV's testcase to ODL directory: %s" % str(e)) - return False - return True - - @classmethod def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"): odl_variables_files = cls.odl_test_repo + 'csit/variables/Variables.py' try: @@ -115,8 +101,7 @@ class ODLTestCases(TestCasesBase.TestCasesBase): self.logger.error("Cannot run ODL testcases. Please check " "%s" % str(e)) return self.EX_RUN_ERROR - if (self.copy_opnf_testcases() and - self.set_robotframework_vars(odlusername, odlpassword)): + if self.set_robotframework_vars(odlusername, odlpassword): try: os.makedirs(self.res_dir) except OSError as e: diff --git a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot b/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot deleted file mode 100644 index c2714c69..00000000 --- a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot +++ /dev/null @@ -1,30 +0,0 @@ -*** Variables *** -${NeutronNorthbound} /controller/nb/v2/neutron -${NetworkNorthbound} ${NeutronNorthbound}/networks -${SubnetNorthbound} ${NeutronNorthbound}/subnets -${PortNorthbound} ${NeutronNorthbound}/ports - -*** Settings *** -Suite Setup Create Session ODL http://${ODL_SYSTEM_IP}:${PORT} headers=${HEADERS} auth=${AUTH} -Suite Teardown Delete All Sessions -Library RequestsLibrary -Variables ../../../variables/Variables.py - -*** Test Cases *** -Get the complete list of networks - [Documentation] Get the complete list of networks - [Tags] reachability - ${resp} get request ODL ${NetworkNorthbound} - Should be Equal As Strings ${resp.status_code} 200 - -Get the complete list of subnets - [Documentation] Get the complete list of subnets - [Tags] reachability - ${resp} get request ODL ${SubnetNorthbound} - Should be Equal As Strings ${resp.status_code} 200 - -Get the complete list of ports - [Documentation] Get the complete list of ports - [Tags] reachability - ${resp} get request ODL ${PortNorthbound} - Should be Equal As Strings ${resp.status_code} 200 diff --git a/unit_tests/odl/test_odl.py b/unit_tests/odl/test_odl.py index 76732593..cbe4df68 100644 --- a/unit_tests/odl/test_odl.py +++ b/unit_tests/odl/test_odl.py @@ -43,19 +43,6 @@ class ODLTestCasesTesting(unittest.TestCase): os.environ["OS_TENANT_NAME"] = self._os_tenantname self.test = OpenDaylightTesting.ODLTestCases() - @mock.patch('shutil.copy', side_effect=Exception()) - def test_copy_opnf_testcases_exception(self, *args): - with self.assertRaises(Exception): - self.test.copy_opnf_testcases() - - @mock.patch('shutil.copy', side_effect=IOError()) - def test_copy_opnf_testcases_ioerror(self, *args): - self.assertFalse(self.test.copy_opnf_testcases()) - - @mock.patch('shutil.copy') - def test_copy_opnf_testcases(self, *args): - self.assertTrue(self.test.copy_opnf_testcases()) - @mock.patch('fileinput.input', side_effect=Exception()) def test_set_robotframework_vars_failed(self, *args): self.assertFalse(self.test.set_robotframework_vars()) @@ -159,57 +146,41 @@ class ODLTestCasesTesting(unittest.TestCase): def test_main_missing_odlrestconfport(self): self._test_main_missing_keyword('odlrestconfport') - def test_main_copy_opnf_testcases_failed(self): - with mock.patch.object(self.test, 'copy_opnf_testcases', - return_value=False): - self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR) - self.test.copy_opnf_testcases.assert_called_once_with() - def test_main_set_robotframework_vars_failed(self): - with mock.patch.object(self.test, 'copy_opnf_testcases', - return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=False): + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=False): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR) self.test.set_robotframework_vars.assert_called_once_with( self._odl_username, self._odl_password) @mock.patch('os.makedirs', side_effect=Exception) def test_main_makedirs_exception(self, mock_method): - with mock.patch.object(self.test, - 'copy_opnf_testcases', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=True), \ self.assertRaises(Exception): self._test_main(TestCasesBase.TestCasesBase.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, - 'copy_opnf_testcases', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True): + with mock.patch.object(self.test, 'set_robotframework_vars', + return_value=True): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, mock_method) @mock.patch('robot.run', side_effect=RobotError) @mock.patch('os.makedirs') def test_main_robot_run_failed(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ self.assertRaises(RobotError): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args) @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_parse_results_failed(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results', side_effect=RobotError): self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args) @@ -218,10 +189,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_remove_exception(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'), \ self.assertRaises(Exception): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -230,10 +199,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -241,10 +208,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs', side_effect=OSError(errno.EEXIST, '')) def test_main_makedirs_oserror17(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -252,10 +217,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run', return_value=1) @mock.patch('os.makedirs') def test_main_testcases_in_failure(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) @@ -263,10 +226,8 @@ class ODLTestCasesTesting(unittest.TestCase): @mock.patch('robot.run') @mock.patch('os.makedirs') def test_main_remove_oserror(self, *args): - with mock.patch.object(self.test, 'copy_opnf_testcases', + with mock.patch.object(self.test, 'set_robotframework_vars', return_value=True), \ - mock.patch.object(self.test, 'set_robotframework_vars', - return_value=True), \ mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) |