diff options
author | Shobhi Jain <shobhi.jain@intel.com> | 2018-02-21 16:13:16 +0000 |
---|---|---|
committer | Shobhi Jain <shobhi.jain@intel.com> | 2018-03-20 16:28:15 +0000 |
commit | 68c934be759962d18d109fde35726f416088a126 (patch) | |
tree | ecf8df2ea20ce4c4095da92d6fea4c400e7502c0 /yardstick/tests/unit/common/test_openstack_utils.py | |
parent | 16aa0b60244b742c2b6478cea93b1eebce4c335f (diff) |
Replace neutron router interface deletion with shade.
Function remove_interface_router now uses shade client instead of neutron
client.
JIRA: YARDSTICK-890
Change-Id: I6bd36e35a339cce64dfa8b69c1e7b56cd70af956
Signed-off-by: Shobhi Jain <shobhi.jain@intel.com>
Diffstat (limited to 'yardstick/tests/unit/common/test_openstack_utils.py')
-rw-r--r-- | yardstick/tests/unit/common/test_openstack_utils.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/yardstick/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py index e39a13f1b..640d2d2c9 100644 --- a/yardstick/tests/unit/common/test_openstack_utils.py +++ b/yardstick/tests/unit/common/test_openstack_utils.py @@ -185,3 +185,26 @@ class CreateNeutronRouterTestCase(unittest.TestCase): self.mock_shade_client) mock_logger.error.assert_called_once() self.assertIsNone(output) + + +class RemoveRouterInterfaceTestCase(unittest.TestCase): + + def setUp(self): + self.mock_shade_client = mock.Mock() + self.router = 'router' + self.mock_shade_client.remove_router_interface = mock.Mock() + + def test_remove_router_interface(self): + self.mock_shade_client.remove_router_interface.return_value = True + output = openstack_utils.remove_router_interface( + self.mock_shade_client, self.router) + self.assertTrue(output) + + @mock.patch.object(openstack_utils, 'log') + def test_remove_router_interface_exception(self, mock_logger): + self.mock_shade_client.remove_router_interface.side_effect = ( + exc.OpenStackCloudException('error message')) + output = openstack_utils.remove_router_interface( + self.mock_shade_client, self.router) + mock_logger.error.assert_called_once() + self.assertFalse(output) |