#NEWLINE# def test_upload_content_filename( self ) : #NEWLINE# #INDENT# g = self . prepare_form_grab ( ) #NEWLINE# data = b'foo' #NEWLINE# upload_data = UploadContent ( data , filename = 'avatar.jpg' ) #NEWLINE# g . doc . set_input ( 'image' , upload_data ) #NEWLINE# g . doc . submit ( make_request = False ) #NEWLINE# post = dict ( g . config [ 'multipart_post' ] ) #NEWLINE# self . assertTrue ( isinstance ( post [ 'image' ] , UploadContent ) ) #NEWLINE# g . doc . submit ( ) #NEWLINE# self . assertEqual ( self , self . server . request [ 'files' ] [ 'image' ] [ 0 ] [ 'body' ] ) #NEWLINE# self . assertEqual ( 'avatar.jpg' , self . server . request [ 'files' ] [ 'image' ] [ 0 ] [ 'filename' ] ) #NEWLINE# self . assertEqual ( 'image/jpeg' , self . server . request [ 'files' ] [ 'image' ] [ 0 ] [ 'content_type' ] )