def test_convert_image_without_direct_io_support(self, mock_execute, mock_direct_io): images._convert_image('source', 'dest', 'in_format', 'out_format', run_as_root=False) expected = ('qemu-img', 'convert', '-t', 'writethrough', '-O', 'out_format', '-f', 'in_format', 'source', 'dest') self.assertTupleEqual(expected, mock_execute.call_args[0])
def test_convert_image_without_direct_io_support(self, mock_execute, mock_direct_io): images._convert_image('source', 'dest', 'in_format', 'out_format', run_as_root=False) expected = ('qemu-img', 'convert', '-t', 'writethrough', '-O', 'out_format', '-f', 'in_format', 'source', 'dest') self.assertTupleEqual(expected, mock_execute.call_args[0])
def test_convert_image_with_direct_io_support(self, mock_execute, mock_direct_io, mock_disk_op_sema): images._convert_image('source', 'dest', 'in_format', 'out_format', run_as_root=False) expected = ('qemu-img', 'convert', '-t', 'none', '-O', 'out_format', '-f', 'in_format', 'source', 'dest') mock_disk_op_sema.__enter__.assert_called_once() self.assertTupleEqual(expected, mock_execute.call_args[0])
def test_convert_image_with_direct_io_support(self, mock_execute, mock_direct_io, mock_disk_op_sema): images._convert_image('source', 'dest', 'in_format', 'out_format', run_as_root=False) expected = ('qemu-img', 'convert', '-t', 'none', '-O', 'out_format', '-f', 'in_format', 'source', 'dest') mock_disk_op_sema.__enter__.assert_called_once() self.assertTupleEqual(expected, mock_execute.call_args[0])