#NEWLINE# @ mock . patch . object ( os , 'unlink' , autospec = True ) #NEWLINE# @ mock . patch . object ( disk_utils , 'convert_image' , autospec = True ) #NEWLINE# @ mock . patch . object ( disk_utils , 'qemu_img_info' , autospec = True ) #NEWLINE# def test_image_to_raw_not_raw_after_conversion( self , qemu_img_info_mock , convert_image_mock , unlink_mock ) : #NEWLINE# #INDENT# CONF . set_override ( 'force_raw_images' , True ) #NEWLINE# info = self . FakeImgInfo ( ) #NEWLINE# info . file_format = 'fmt' #NEWLINE# info . backing_file = None #NEWLINE# qemu_img_info_mock . return_value = convert_image_mock #NEWLINE# self . assertRaises ( exception . ImageConvertFailed , images . image_to_raw , 'image_href' , 'path' , 'path_tmp' ) #NEWLINE# qemu_img_info_mock . assert_has_calls ( [ mock . call ( 'path_tmp' ) , mock . call ( 'path.converted' ) ] ) #NEWLINE# convert_image_mock . assert_called_once_with ( 'path_tmp' , 'path.converted' , 'raw' ) #NEWLINE# unlink_mock . assert_called_once_with ( 'path_tmp' )