1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Refs #28184 -- Added test for FileField storage default.

Co-authored-by: miigotu <miigotu@gmail.com>
This commit is contained in:
Carlton Gibson 2020-04-08 10:35:15 +02:00 committed by Carlton Gibson
parent 210657b791
commit 94b32a20ef

View File

@ -14,7 +14,8 @@ from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation
from django.core.files.base import ContentFile, File
from django.core.files.storage import (
FileSystemStorage, Storage as BaseStorage, get_storage_class,
FileSystemStorage, Storage as BaseStorage, default_storage,
get_storage_class,
)
from django.core.files.uploadedfile import (
InMemoryUploadedFile, SimpleUploadedFile, TemporaryUploadedFile,
@ -885,6 +886,9 @@ class FieldCallableFileStorageTests(SimpleTestCase):
with self.assertRaisesMessage(TypeError, msg):
FileField(storage=invalid_type)
def test_file_field_storage_none_uses_default_storage(self):
self.assertEqual(FileField().storage, default_storage)
def test_callable_function_storage_file_field(self):
storage = FileSystemStorage(location=self.temp_storage_location)