Skip to content

Commit 61b23c5

Browse files
committed
Update tests
1 parent e0e7f34 commit 61b23c5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

filer/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import typing
22

3-
from django.db.models import Model
43
from django.core.cache import cache
4+
from django.db.models import Model
55

66

77
UserModel = typing.TypeVar('UserModel', bound=Model)

tests/test_admin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import django
55
import django.core.files
6+
from django.apps import apps
67
from django.conf import settings
78
from django.contrib import admin
89
from 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

Comments
 (0)