33
44import django
55import django .core .files
6+ from django .apps import apps
67from django .conf import settings
78from django .contrib import admin
89from django .contrib .admin import helpers
@@ -484,6 +485,10 @@ def test_filer_upload_file_no_folder(self, extra_headers={}):
484485 self .assertEqual (stored_image .mime_type , 'image/jpeg' )
485486
486487 def test_filer_upload_binary_data (self , extra_headers = {}):
488+ config = apps .get_app_config ("filer" )
489+
490+ validators = config .FILE_VALIDATORS # Remember the validators
491+ config .FILE_VALIDATORS = {} # Remove deny for application/octet-stream
487492 self .assertEqual (File .objects .count (), 0 )
488493 with open (self .binary_filename , 'rb' ) as fh :
489494 file_obj = django .core .files .File (fh )
@@ -494,6 +499,8 @@ def test_filer_upload_binary_data(self, extra_headers={}):
494499 'jsessionid' : self .client .session .session_key
495500 }
496501 self .client .post (url , post_data , ** extra_headers )
502+ config .FILE_VALIDATORS = validators # Reset validators
503+
497504 self .assertEqual (Image .objects .count (), 0 )
498505 self .assertEqual (File .objects .count (), 1 )
499506 stored_file = File .objects .first ()
0 commit comments