summaryrefslogtreecommitdiff
path: root/tests/file_storage/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/file_storage/tests.py')
-rw-r--r--tests/file_storage/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index a0234b2f9d..92962bd9a0 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -29,6 +29,7 @@ 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.functional import empty
from .models import (
Storage,
@@ -1267,3 +1268,11 @@ class StorageHandlerTests(SimpleTestCase):
)
with self.assertRaisesMessage(InvalidStorageError, msg):
test_storages["invalid_backend"]
+
+
+class StorageLazyObjectTests(SimpleTestCase):
+ def test_lazy_object_is_not_evaluated_before_manual_access(self):
+ obj = Storage()
+ self.assertIs(obj.lazy_storage.storage._wrapped, empty)
+ # assertEqual triggers resolution.
+ self.assertEqual(obj.lazy_storage.storage, temp_storage)