#NEWLINE# def test_upload_unsupported_file_format( self ) : #NEWLINE# #INDENT# xyz_file = StringIO ( ) #NEWLINE# xyz = Image . new ( 'RGBA' , size = ( 50 , 50 ) , color = ( 256 , 0 , 0 ) ) #NEWLINE# xyz . save ( xyz_file , 'png' ) #NEWLINE# xyz_file . seek ( 0 ) #NEWLINE# data = { #NEWLINE# #INDENT# 'name' : 'A test image' , #NEWLINE# 'description' : 'Test image description' , #NEWLINE# 'file' : ContentFile ( xyz_file . read ( ) , 'test.xyz' ) , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . post ( self . admin , data = data ) #NEWLINE# self . assertEqual ( response . status_code , 400 )