

@mock.patch.object(api, 'can_resize_image', return_value=True)
@mock.patch.object(api, 'is_image_extendable')
@mock.patch.object(utils, 'execute')
def test_extend_qcow_no_resize(self, mock_execute, mock_extendable, mock_can_resize_image):
    imgfile = tempfile.NamedTemporaryFile()
    self.addCleanup(imgfile.close)
    imgsize = 10
    image = imgmodel.LocalFileImage(imgfile, imgmodel.FORMAT_QCOW2)
    self.flags(resize_fs_using_block_device=False)
    api.extend(image, imgsize)
    mock_can_resize_image.assert_called_once_with(imgfile, imgsize)
    mock_execute.assert_called_once_with('qemu-img', 'resize', imgfile, imgsize)
    self.assertFalse(mock_extendable.called)

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/disk/test_api.py APITestCase.test_extend_qcow_no_resize/original