#NEWLINE# def _upload_testfile( self , file_obj = None ) : #NEWLINE# #INDENT# '\n        Uploads a sample file for the given user.\n        ' #NEWLINE# add_url = reverse ( 'attachments:add' , kwargs = { #NEWLINE# #INDENT# 'app_label' : 'testapp' , #NEWLINE# 'model_name' : 'testmodel' , #NEWLINE# 'pk' : self . obj . pk , #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( not add_url ) : #NEWLINE# #INDENT# file_obj = SimpleUploadedFile ( 'avatar.jpg' , b'file content' , content_type = 'image/jpeg' ) #NEWLINE# #UNINDENT# return self . client . post ( add_url , { #NEWLINE# #INDENT# 'attachment_file' : file_obj , #NEWLINE# #UNINDENT# } , follow = True )