Merge "Modify the test of 'test_delete_success'"

This commit is contained in:
Zuul 2018-03-13 02:39:24 +00:00 committed by Gerrit Code Review
commit 7d787c580d

View File

@ -147,10 +147,13 @@ class TestDockerDriver(base.DriverTestCase):
self.assertEqual(result_container.status,
consts.CREATED)
def test_delete_success(self):
@mock.patch('zun.container.docker.driver.DockerDriver'
'._cleanup_network_for_container')
def test_delete_success(self, mock_cleanup_network_for_container):
self.mock_docker.remove_container = mock.Mock()
mock_container = mock.MagicMock()
mock_container = self.mock_default_container
self.driver.delete(self.context, mock_container, True)
self.assertTrue(mock_cleanup_network_for_container.called)
self.mock_docker.remove_container.assert_called_once_with(
mock_container.container_id, force=True)