

@mock.patch('see.context.resources.qemu.libvirt')
@mock.patch('see.context.resources.qemu.domain_create')
@mock.patch('see.context.resources.qemu.disk_clone')
@mock.patch('see.context.resources.qemu.pool_create')
def test_initialize_clone(self, pool_mock, disk_mock, create_mock, libvirt_mock):
    'Resources initializer with disk cloning.'
    pool = mock.MagicMock()
    pool_mock.return_value = pool
    volume = mock.Mock()
    self.path.return_value = '/foo/bar'
    pool.storageVolLookupByName.return_value = volume
    resources = qemu.QEMUResources('foo', {
        'domain': 'bar',
        'disk': {
            'image': '/foo/bar.qcow2',
            'clone': {
                'storage_pool_path': '/baz',
            },
        },
    })
    pool_mock.assert_called_with(resources.hypervisor, 'foo', '/baz')
    disk_mock.assert_called_with(resources.hypervisor, 'foo', pool, {
        'image': '/foo/bar.qcow2',
        'clone': {
            'storage_pool_path': '/baz',
        },
    })
    create_mock.assert_called_with(resources.hypervisor, 'foo', 'bar', '/foo/bar', network_name=None)

dataset/ETHPy150Open F-Secure/see/see/context/resources/test/qemu_test.py ResourcesTest.test_initialize_clone/VarMisuse@74/147 `volume`->`self`