#NEWLINE# @ mock . patch . object ( utils , 'tempdir' , autospec = True ) #NEWLINE# @ mock . patch . object ( ironic_utils , 'dd' , autospec = True ) #NEWLINE# @ mock . patch . object ( ironic_utils , 'mkfs' , autospec = True ) #NEWLINE# def test_create_vfat_image_mkfs_fails( self , mkfs_mock , dd_mock , tempdir_mock ) : #NEWLINE# #INDENT# mock_file_handle = mock . MagicMock ( spec = file ) #NEWLINE# mock_file_handle . __enter__ . return_value = 'tempdir' #NEWLINE# tempdir_mock . return_value = mkfs_mock #NEWLINE# mkfs_mock . side_effect = processutils . ProcessExecutionError #NEWLINE# self . assertRaises ( exception . ImageCreationFailed , images . create_vfat_image , 'tgt_file' )