#NEWLINE# def test_parent_collection_is_fetched_only_once_in_batch( self ) : #NEWLINE# #INDENT# batch = { #NEWLINE# #INDENT# 'requests' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# nb_create = 25 #NEWLINE# for i in range ( nb_create ) : #NEWLINE# #INDENT# request = { #NEWLINE# #INDENT# 'method' : 'POST' , #NEWLINE# 'path' : self . collection_url , #NEWLINE# 'body' : MINIMALIST_RECORD , #NEWLINE# #UNINDENT# } #NEWLINE# batch [ 'requests' ] . append ( request ) #NEWLINE# #UNINDENT# with mock . patch . object ( self . storage , 'get' , wraps = self . storage . get ) as patched : #NEWLINE# #INDENT# self . app . post_json ( '/batch' , batch , headers = self . headers ) #NEWLINE# self . assertEqual ( patched . call_count , 1 )