Add testcase for deleting nonexist container

Change-Id: I3060cedf328d34c3ff64727095cc985ec19d72b8
This commit is contained in:
Feng Shengqin 2017-02-15 17:02:02 +08:00
parent 4c279c67e0
commit 404b6c0611

View File

@ -1049,6 +1049,16 @@ class TestContainerController(api_base.FunctionalTest):
mock.ANY, test_container_obj, False)
mock_destroy.assert_called_once_with(mock.ANY)
def test_delete_container_with_uuid_not_found(self):
uuid = uuidutils.generate_uuid()
self.assertRaises(AppError, self.app.delete,
'/v1/containers/%s' % uuid)
def test_delete_container_with_name_not_found(self):
name = 'not_found'
self.assertRaises(AppError, self.app.delete,
'/v1/containers/%s' % name)
@patch('zun.common.utils.validate_container_state')
@patch('zun.compute.api.API.container_kill')
@patch('zun.objects.Container.get_by_uuid')