#NEWLINE# @ mock . patch . object ( images , '_create_root_fs' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'tempdir' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'write_to_file' , autospec = True ) #NEWLINE# @ mock . patch . object ( ironic_utils , 'dd' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'umount' , autospec = True ) #NEWLINE# @ mock . patch . object ( utils , 'mount' , autospec = True ) #NEWLINE# @ mock . patch . object ( ironic_utils , 'mkfs' , autospec = True ) #NEWLINE# def test_create_vfat_image( self , mkfs_mock , mount_mock , umount_mock , dd_mock , write_mock , tempdir_mock , create_root_fs_mock ) : #NEWLINE# #INDENT# mock_file_handle = mock . MagicMock ( spec = file ) #NEWLINE# mock_file_handle . __enter__ . return_value = 'tempdir' #NEWLINE# tempdir_mock . return_value = mock_file_handle #NEWLINE# parameters = { #NEWLINE# #INDENT# 'p1' : 'v1' , #NEWLINE# #UNINDENT# } #NEWLINE# files_info = { #NEWLINE# #INDENT# 'a' : 'b' , #NEWLINE# #UNINDENT# } #NEWLINE# images . create_vfat_image ( 'tgt_file' , parameters = parameters , files_info = files_info , parameters_file = 'qwe' , fs_size_kib = 1000 ) #NEWLINE# dd_mock . assert_called_once_with ( '/dev/zero' , 'tgt_file' , 'count=1' , 'bs=1000KiB' ) #NEWLINE# mkfs_mock . assert_called_once_with ( 'vfat' , 'tgt_file' , label = 'ir-vfd-dev' ) #NEWLINE# mount_mock . assert_called_once_with ( 'tgt_file' , 'tempdir' , '-o' , 'umask=0' ) #NEWLINE# parameters_file_path = os . path . join ( 'tempdir' , 'qwe' ) #NEWLINE# write_mock . assert_called_once_with ( parameters_file_path , 'p1=v1' ) #NEWLINE# create_root_fs_mock . assert_called_once_with ( 'tempdir' , files_info ) #NEWLINE# umount_mock . assert_called_once_with ( 'tempdir' )