def test_copy_virtual_disk(self): session = fake.FakeSession() dm = session.vim.service_content.virtualDiskManager with contextlib.nested( mock.patch.object(session, "_call_method", return_value='fake-task'), mock.patch.object(session, "_wait_for_task"), ) as (fake_call_method, fake_wait_for_task): vm_util.copy_virtual_disk(session, 'fake-dc-ref', 'fake-source', 'fake-dest') fake_call_method.assert_called_once_with( session.vim, "CopyVirtualDisk_Task", dm, sourceName='fake-source', sourceDatacenter='fake-dc-ref', destName='fake-dest') fake_wait_for_task.assert_called_once_with('fake-task')
def test_copy_virtual_disk(self): session = fake_session() dm = session._get_vim().get_service_content().virtualDiskManager with contextlib.nested( mock.patch.object(session, "_call_method", return_value="fake-task"), mock.patch.object(session, "_wait_for_task"), ) as (fake_call_method, fake_wait_for_task): vm_util.copy_virtual_disk(session, "fake-dc-ref", "fake-source", "fake-dest", "fake-spec") fake_call_method.assert_called_once_with( session._get_vim(), "CopyVirtualDisk_Task", dm, sourceName="fake-source", sourceDatacenter="fake-dc-ref", destName="fake-dest", destSpec="fake-spec", ) fake_wait_for_task.assert_called_once_with("fake-task")