diff options
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) |