#NEWLINE# @ mock . patch . object ( images , '_create_root_fs' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'write_to_file' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'tempdir' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'execute' , autospec = True ) #NEWLINE# @ mock . patch . object ( images , '_generate_cfg' , autospec = True ) #NEWLINE# def test_create_isolinux_image_for_bios( self , gen_cfg_mock , execute_mock , tempdir_mock , write_to_file_mock , create_root_fs_mock ) : #NEWLINE# #INDENT# mock_file_handle = mock . MagicMock ( spec = file ) #NEWLINE# mock_file_handle . __enter__ . return_value = 'tmpdir' #NEWLINE# tempdir_mock . return_value = mock_file_handle #NEWLINE# cfg = 'cfg' #NEWLINE# cfg_file = 'tmpdir/isolinux/isolinux.cfg' #NEWLINE# gen_cfg_mock . return_value = cfg #NEWLINE# params = [ 'a=b' , 'c' ] #NEWLINE# isolinux_options = { #NEWLINE# #INDENT# 'kernel' : '/vmlinuz' , #NEWLINE# 'ramdisk' : '/initrd' , #NEWLINE# #UNINDENT# } #NEWLINE# images . create_isolinux_image_for_bios ( 'tgt_file' , 'path/to/kernel' , 'path/to/ramdisk' , kernel_params = params ) #NEWLINE# files_info = { #NEWLINE# #INDENT# 'path/to/kernel' : 'vmlinuz' , #NEWLINE# 'path/to/ramdisk' : 'initrd' , #NEWLINE# CONF . isolinux_bin : 'isolinux/isolinux.bin' , #NEWLINE# #UNINDENT# } #NEWLINE# create_root_fs_mock . assert_called_once_with ( 'tmpdir' , files_info ) #NEWLINE# gen_cfg_mock . assert_called_once_with ( params , CONF . isolinux_config_template , isolinux_options ) #NEWLINE# write_to_file_mock . assert_called_once_with ( cfg_file , cfg ) #NEWLINE# execute_mock . assert_called_once_with ( 'mkisofs' , '-r' , '-V' , 'VMEDIA_BOOT_ISO' , '-cache-inodes' , '-J' , '-l' , '-no-emul-boot' , '-boot-load-size' , '4' , '-boot-info-table' , '-b' , 'isolinux/isolinux.bin' , '-o' , 'tgt_file' , 'tmpdir' )