mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #26896 -- Allowed a lazy base_url for FileSystemStorage.
This commit is contained in:
parent
0850236a8c
commit
b820b6108a
2 changed files with 12 additions and 3 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue