summaryrefslogtreecommitdiff
path: root/tests/file_storage
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-15 05:58:54 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-09-18 22:12:40 +0200
commitf72f420f17c1bf6aea4022ecdb9b5f53a46597cc (patch)
treebcba9c795159eb40ae916ce520a25c9e9d796ecf /tests/file_storage
parent3a3e737694b89e29308e54f12faaa375226b7060 (diff)
Refs #26029 -- Removed DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings.
This also removes django.core.files.storage.get_storage_class(). Per deprecation timeline.
Diffstat (limited to 'tests/file_storage')
-rw-r--r--tests/file_storage/tests.py61
1 files changed, 3 insertions, 58 deletions
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 6ff56ae169..8c47e43742 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -15,18 +15,9 @@ from django.conf import DEFAULT_STORAGE_ALIAS, STATICFILES_STORAGE_ALIAS
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 (
- GET_STORAGE_CLASS_DEPRECATED_MSG,
- FileSystemStorage,
- InvalidStorageError,
-)
+from django.core.files.storage import FileSystemStorage, InvalidStorageError
from django.core.files.storage import Storage as BaseStorage
-from django.core.files.storage import (
- StorageHandler,
- default_storage,
- get_storage_class,
- storages,
-)
+from django.core.files.storage import StorageHandler, default_storage, storages
from django.core.files.uploadedfile import (
InMemoryUploadedFile,
SimpleUploadedFile,
@@ -35,11 +26,10 @@ from django.core.files.uploadedfile import (
from django.db.models import FileField
from django.db.models.fields.files import FileDescriptor
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, override_settings
-from django.test.utils import ignore_warnings, requires_tz_support
+from django.test.utils import requires_tz_support
from django.urls import NoReverseMatch, reverse_lazy
from django.utils import timezone
from django.utils._os import symlinks_supported
-from django.utils.deprecation import RemovedInDjango51Warning
from .models import (
Storage,
@@ -52,51 +42,6 @@ from .models import (
FILE_SUFFIX_REGEX = "[A-Za-z0-9]{7}"
-class GetStorageClassTests(SimpleTestCase):
- @ignore_warnings(category=RemovedInDjango51Warning)
- def test_get_filesystem_storage(self):
- """
- get_storage_class returns the class for a storage backend name/path.
- """
- self.assertEqual(
- get_storage_class("django.core.files.storage.FileSystemStorage"),
- FileSystemStorage,
- )
-
- @ignore_warnings(category=RemovedInDjango51Warning)
- def test_get_invalid_storage_module(self):
- """
- get_storage_class raises an error if the requested import don't exist.
- """
- with self.assertRaisesMessage(ImportError, "No module named 'storage'"):
- get_storage_class("storage.NonexistentStorage")
-
- @ignore_warnings(category=RemovedInDjango51Warning)
- def test_get_nonexistent_storage_class(self):
- """
- get_storage_class raises an error if the requested class don't exist.
- """
- with self.assertRaises(ImportError):
- get_storage_class("django.core.files.storage.NonexistentStorage")
-
- @ignore_warnings(category=RemovedInDjango51Warning)
- def test_get_nonexistent_storage_module(self):
- """
- get_storage_class raises an error if the requested module don't exist.
- """
- with self.assertRaisesMessage(
- ImportError, "No module named 'django.core.files.nonexistent_storage'"
- ):
- get_storage_class(
- "django.core.files.nonexistent_storage.NonexistentStorage"
- )
-
- def test_deprecation_warning(self):
- msg = GET_STORAGE_CLASS_DEPRECATED_MSG
- with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
- get_storage_class("django.core.files.storage.FileSystemStorage")
-
-
class FileSystemStorageTests(unittest.TestCase):
def test_deconstruction(self):
path, args, kwargs = temp_storage.deconstruct()