#NEWLINE# def check_upload( self , file_ , listed = None ) : #NEWLINE# #INDENT# 'Check that our file upload is matched to the given file.' #NEWLINE# va = utils . ValidationAnnotator ( self . file_upload ) #NEWLINE# assert ( file_ . prev_file == file_ ) #NEWLINE# if file_ : #NEWLINE# #INDENT# self . validate_file . assert_called_once_with ( [ file_ . pk ] , { #NEWLINE# #INDENT# 'hash_' : file_ . original_hash , #NEWLINE# 'is_webextension' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( not self . validate_file . called ) #NEWLINE# #UNINDENT# self . validate_upload . assert_called_once_with ( [ self . file_upload . path ] , { #NEWLINE# #INDENT# 'hash_' : self . file_upload . hash , #NEWLINE# 'listed' : listed , #NEWLINE# 'is_webextension' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . save_upload . assert_has_calls ( [ mock . call ( [ mock . ANY , self . file_upload . pk ] , { #NEWLINE# #INDENT# 'annotate' : False , #NEWLINE# #UNINDENT# } , immutable = True ) , mock . call ( [ self . file_upload . pk ] , link_error = mock . ANY ) ] )