diff options
Diffstat (limited to 'unit_tests')
-rw-r--r-- | unit_tests/odl/test_odl.py | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/unit_tests/odl/test_odl.py b/unit_tests/odl/test_odl.py index e943dcaf4..76732593e 100644 --- a/unit_tests/odl/test_odl.py +++ b/unit_tests/odl/test_odl.py @@ -35,8 +35,9 @@ class ODLTestCasesTesting(unittest.TestCase): _odl_password = "admin" def setUp(self): - if "INSTALLER_TYPE" in os.environ: - del os.environ["INSTALLER_TYPE"] + for var in ("INSTALLER_TYPE", "SDN_CONTROLLER", "SDN_CONTROLLER_IP"): + if var in os.environ: + del os.environ[var] os.environ["OS_USERNAME"] = self._os_username os.environ["OS_PASSWORD"] = self._os_password os.environ["OS_TENANT_NAME"] = self._os_tenantname @@ -63,11 +64,6 @@ class ODLTestCasesTesting(unittest.TestCase): def test_set_robotframework_vars(self, args): self.assertTrue(self.test.set_robotframework_vars()) - def _test_run_missing_env_var(self, var): - del os.environ[var] - self.assertEqual(self.test.run(), - TestCasesBase.TestCasesBase.EX_RUN_ERROR) - @classmethod def _fake_url_for(cls, service_type='identity', **kwargs): if service_type == 'identity': @@ -274,6 +270,11 @@ class ODLTestCasesTesting(unittest.TestCase): mock.patch.object(self.test, 'parse_results'): self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args) + def _test_run_missing_env_var(self, var): + del os.environ[var] + self.assertEqual(self.test.run(), + TestCasesBase.TestCasesBase.EX_RUN_ERROR) + def _test_run(self, status=TestCasesBase.TestCasesBase.EX_OK, exception=None, odlip="127.0.0.3", odlwebport="8080"): with mock.patch('functest.utils.openstack_utils.get_keystone_client', @@ -314,6 +315,12 @@ class ODLTestCasesTesting(unittest.TestCase): odlip=self._sdn_controller_ip, odlwebport=self._odl_webport) + def test_run_missing_sdn_controller_ip(self): + with mock.patch('functest.utils.openstack_utils.get_keystone_client', + return_value=self._get_fake_keystone_client()): + self.assertEqual(self.test.run(), + TestCasesBase.TestCasesBase.EX_RUN_ERROR) + def test_run_without_installer_type(self): os.environ["SDN_CONTROLLER_IP"] = self._sdn_controller_ip self._test_run(TestCasesBase.TestCasesBase.EX_OK, @@ -325,12 +332,26 @@ class ODLTestCasesTesting(unittest.TestCase): self._test_run(TestCasesBase.TestCasesBase.EX_OK, odlip=self._neutron_ip, odlwebport='8282') + def test_run_apex_missing_sdn_controller_ip(self): + with mock.patch('functest.utils.openstack_utils.get_keystone_client', + return_value=self._get_fake_keystone_client()): + os.environ["INSTALLER_TYPE"] = "apex" + self.assertEqual(self.test.run(), + TestCasesBase.TestCasesBase.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(TestCasesBase.TestCasesBase.EX_OK, odlip=self._sdn_controller_ip, odlwebport='8181') + def test_run_joid_missing_sdn_controller(self): + with mock.patch('functest.utils.openstack_utils.get_keystone_client', + return_value=self._get_fake_keystone_client()): + os.environ["INSTALLER_TYPE"] = "joid" + self.assertEqual(self.test.run(), + TestCasesBase.TestCasesBase.EX_RUN_ERROR) + def test_run_joid(self): os.environ["SDN_CONTROLLER"] = self._sdn_controller_ip os.environ["INSTALLER_TYPE"] = "joid" |