#NEWLINE# def test_get_file_map( self ) : #NEWLINE# #INDENT# node = factories . NodeFactory ( creator = self . user ) #NEWLINE# file_tree = file_tree_factory ( 3 , 3 , 3 ) #NEWLINE# with mock . patch . object ( StorageAddonBase , '_get_file_tree' , mock . Mock ( return_value = file_tree ) ) : #NEWLINE# #INDENT# file_map = archiver_utils . get_file_map ( node ) #NEWLINE# #UNINDENT# stack = [ file_tree ] #NEWLINE# file_map = { sha256 : value for ( sha256 , value , _ ) in file_map } #NEWLINE# while len ( stack ) : #NEWLINE# #INDENT# item = stack . pop ( 0 ) #NEWLINE# if ( item [ 'kind' ] == 'file' ) : #NEWLINE# #INDENT# sha256 = item [ 'extra' ] [ 'hashes' ] [ 'sha256' ] #NEWLINE# assert_in ( sha256 , file_map ) #NEWLINE# map_file = file_map [ _ ] #NEWLINE# assert_equal ( item , map_file ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stack = ( stack + item [ 'children' ] )