#NEWLINE# @ mock . patch . object ( copyimage . os . path , 'exists' ) #NEWLINE# @ mock . patch . object ( hu , 'is_block_device' ) #NEWLINE# @ mock . patch . object ( utils , 'calculate_md5' ) #NEWLINE# @ mock . patch ( 'os.path.getsize' ) #NEWLINE# @ mock . patch . object ( fu , 'extend_fs' ) #NEWLINE# @ mock . patch . object ( au , 'GunzipStream' ) #NEWLINE# @ mock . patch . object ( au , 'LocalFile' ) #NEWLINE# @ mock . patch . object ( au , 'HttpUrl' ) #NEWLINE# @ mock . patch . object ( au , 'Chain' ) #NEWLINE# @ mock . patch . object ( utils , 'execute' ) #NEWLINE# @ mock . patch . object ( utils , 'render_and_save' ) #NEWLINE# @ mock . patch . object ( hu , 'list_block_devices' ) #NEWLINE# def test_do_copyimage( self , mock_lbd , mock_u_ras , mock_u_e , mock_au_c , mock_au_h , mock_au_l , mock_au_g , mock_fu_ef , mock_get_size , mock_md5 , mock_ibd , mock_os_path ) : #NEWLINE# #INDENT# mock_os_path . return_value = True #NEWLINE# mock_ibd . return_value = True #NEWLINE# mock_au_c . return_value = FakeChain ( ) #NEWLINE# self . action . execute ( ) #NEWLINE# imgs = self . drv . image_scheme . images #NEWLINE# self . assertEqual ( 2 , len ( mock_au_h ) ) #NEWLINE# expected_processors_list = [ ] #NEWLINE# for img in imgs [ : ( - 1 ) ] : #NEWLINE# #INDENT# expected_processors_list += [ img . uri , au . HttpUrl , au . GunzipStream , img . target_device ] #NEWLINE# #UNINDENT# expected_processors_list += [ imgs [ ( - 1 ) ] . uri , au . LocalFile , imgs [ ( - 1 ) ] . target_device ] #NEWLINE# self . assertEqual ( expected_processors_list , mock_au_c . return_value . processors ) #NEWLINE# mock_fu_ef_expected_calls = [ mock . call ( 'ext4' , '/dev/mapper/os-root' ) ] #NEWLINE# self . assertEqual ( mock_fu_ef_expected_calls , mock_fu_ef . call_args_list )