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
1 changed files with 5 additions and 1 deletions

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)