diff options
Diffstat (limited to 'functest/tests/unit/odl/test_odl.py')
-rwxr-xr-x[-rw-r--r--] | functest/tests/unit/odl/test_odl.py | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py index ef18016b..c29bfd7f 100644..100755 --- a/functest/tests/unit/odl/test_odl.py +++ b/functest/tests/unit/odl/test_odl.py @@ -59,14 +59,6 @@ class ODLTesting(unittest.TestCase): else: return None - @classmethod - def _get_fake_keystone_client(cls): - kclient = mock.Mock() - kclient.service_catalog = mock.Mock() - kclient.service_catalog.url_for = mock.Mock( - side_effect=cls._fake_url_for) - return kclient - def _get_main_kwargs(self, key=None): kwargs = {'odlusername': self._odl_username, 'odlpassword': self._odl_password, @@ -247,8 +239,9 @@ class ODLTesting(unittest.TestCase): def _test_run(self, status=testcase_base.TestcaseBase.EX_OK, exception=None, odlip="127.0.0.3", odlwebport="8080"): - with mock.patch('functest.utils.openstack_utils.get_keystone_client', - return_value=self._get_fake_keystone_client()): + with mock.patch('functest.utils.openstack_utils.get_endpoint', + side_effect=[self._fake_url_for('identity'), + self._fake_url_for('network')]): if exception: self.test.main = mock.Mock(side_effect=exception) else: @@ -288,12 +281,10 @@ class ODLTesting(unittest.TestCase): 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()): - ft_constants.CI_INSTALLER_TYPE = None - ft_constants.SDN_CONTROLLER_IP = None - self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + ft_constants.CI_INSTALLER_TYPE = None + ft_constants.SDN_CONTROLLER_IP = None + self.assertEqual(self.test.run(), + testcase_base.TestcaseBase.EX_RUN_ERROR) def test_run_without_installer_type(self): ft_constants.SDN_CONTROLLER_IP = self._sdn_controller_ip @@ -308,12 +299,10 @@ class ODLTesting(unittest.TestCase): 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()): - ft_constants.CI_INSTALLER_TYPE = "apex" - ft_constants.SDN_CONTROLLER_IP = None - self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + ft_constants.CI_INSTALLER_TYPE = "apex" + ft_constants.SDN_CONTROLLER_IP = None + self.assertEqual(self.test.run(), + testcase_base.TestcaseBase.EX_RUN_ERROR) def test_run_apex(self): ft_constants.SDN_CONTROLLER_IP = self._sdn_controller_ip @@ -322,12 +311,10 @@ class ODLTesting(unittest.TestCase): 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()): - ft_constants.CI_INSTALLER_TYPE = "joid" - ft_constants.SDN_CONTROLLER = None - self.assertEqual(self.test.run(), - testcase_base.TestcaseBase.EX_RUN_ERROR) + ft_constants.CI_INSTALLER_TYPE = "joid" + ft_constants.SDN_CONTROLLER = None + self.assertEqual(self.test.run(), + testcase_base.TestcaseBase.EX_RUN_ERROR) def test_run_joid(self): ft_constants.SDN_CONTROLLER = self._sdn_controller_ip |