summaryrefslogtreecommitdiff
path: root/tests/file_storage
diff options
context:
space:
mode:
authorTomas Pazderka <tomas.pazderka@nic.cz>2016-07-28 13:37:07 +0200
committerTim Graham <timograham@gmail.com>2016-07-29 14:13:54 -0400
commitb820b6108a7d3f11ec18774d16d657f4f63fe9fa (patch)
tree5e94af4f90582e745335a3c2356289af79430d3a /tests/file_storage
parent0850236a8c3647bc3c239bd34afae0488abe5c60 (diff)
downloaddjango-b820b6108a7d3f11ec18774d16d657f4f63fe9fa.tar.gz
Fixed #26896 -- Allowed a lazy base_url for FileSystemStorage.
Diffstat (limited to 'tests/file_storage')
-rw-r--r--tests/file_storage/tests.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
index 337cc749ae..e8425558e8 100644
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -24,6 +24,7 @@ from django.test import (
override_settings,
)
from django.test.utils import requires_tz_support
+from django.urls import NoReverseMatch, reverse_lazy
from django.utils import six, timezone
from django.utils._os import upath
from django.utils.deprecation import RemovedInDjango20Warning
@@ -73,7 +74,7 @@ class GetStorageClassTests(SimpleTestCase):
get_storage_class('django.core.files.non_existing_storage.NonExistingStorage')
-class FileStorageDeconstructionTests(unittest.TestCase):
+class FileSystemStorageTests(unittest.TestCase):
def test_deconstruction(self):
path, args, kwargs = temp_storage.deconstruct()
@@ -89,6 +90,14 @@ class FileStorageDeconstructionTests(unittest.TestCase):
path, args, kwargs = storage.deconstruct()
self.assertEqual(kwargs, kwargs_orig)
+ def test_lazy_base_url_init(self):
+ """
+ FileSystemStorage.__init__() shouldn't evaluate base_url.
+ """
+ storage = FileSystemStorage(base_url=reverse_lazy('app:url'))
+ with self.assertRaises(NoReverseMatch):
+ storage.url(storage.base_url)
+
# Tests for TZ-aware time methods need pytz.
requires_pytz = unittest.skipIf(pytz is None, "this test requires pytz")