

def test_volume_deletion_error(self):
    'The failure of deletion of a Volume does not stop the deletion process.'
    pool = mock.MagicMock()
    logger = mock.Mock()
    volumes = {
        'foo': mock.Mock(),
        'bar': mock.Mock(),
        'baz': mock.Mock(),
    }
    pool.XMLDesc.return_value = '<pool><path>/foo/bar</path></pool>'
    pool.listVolumes.return_value = ('foo', 'bar', 'baz')
    pool.storageVolLookupByName.side_effect = (lambda n: volumes[n])
    volumes['foo'].delete.side_effect = libvirt.libvirtError('BOOM')
    qemu.pool_delete(pool, logger)
    volumes['foo'].delete.assert_called_with(0)
    volumes['bar'].delete.assert_called_with(0)
    volumes['baz'].delete.assert_called_with(0)
    self.assertTrue(pool.destroy.called)

dataset/ETHPy150Open F-Secure/see/see/context/resources/test/qemu_test.py PoolDeleteTest.test_volume_deletion_error/original