@@ -50,13 +50,29 @@ def test_download(self):
5050 file_content = response .data )
5151 sheet .format (int )
5252 array = sheet .to_array ()
53- assert array == self .data
53+ eq_ (array , self .data )
54+
55+ def test_no_file_type (self ):
56+ file_name = 'issue15'
57+ download_file_type = "xls"
58+ io = pe .save_as (dest_file_type = "xls" ,
59+ array = self .data )
60+ if not PY2 :
61+ if not isinstance (io , BytesIO ):
62+ io = BytesIO (io .getvalue ().encode ('utf-8' ))
63+ response = self .app .post (
64+ '/switch/%s' % download_file_type ,
65+ buffered = True ,
66+ data = {"file" : (io , file_name )},
67+ content_type = "multipart/form-data" )
68+ eq_ (response .content_type , 'text/html' )
69+ eq_ (response .status_code , 400 )
5470
5571 def test_override_file_name (self ):
5672 for file_type in FILE_TYPE_MIME_TABLE .keys ():
5773 file_name = 'override_file_name'
5874 response = self .app .post ('/file_name/%s/%s' % (file_type ,
5975 file_name ))
60- assert response .content_type == FILE_TYPE_MIME_TABLE [file_type ]
61- assert response .headers .get ("Content-Disposition" , None ) == (
62- "attachment; filename=%s.%s" % (file_name , file_type ))
76+ eq_ ( response .content_type , FILE_TYPE_MIME_TABLE [file_type ])
77+ eq_ ( response .headers .get ("Content-Disposition" , None ),
78+ ( "attachment; filename=%s.%s" % (file_name , file_type ) ))
0 commit comments