summaryrefslogtreecommitdiff
path: root/tests/check_framework
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-21 09:41:37 +0200
committerGitHub <noreply@github.com>2021-04-21 09:41:37 +0200
commit34d1905712d33e72c76b3a55a4fc24abbd11be6c (patch)
tree5f85f0bc6a22004cd4e562deb22fd8434cde9fee /tests/check_framework
parent5c73fbb6a93ee214678f02ba4027f18dff49337b (diff)
downloaddjango-34d1905712d33e72c76b3a55a4fc24abbd11be6c.tar.gz
Fixed #32665 -- Fixed caches system check crash when STATICFILES_DIRS is a list of 2-tuples.
Thanks Jared Lockhart for the report. Regression in c36075ac1dddfa986340b1a5e15fe48833322372.
Diffstat (limited to 'tests/check_framework')
-rw-r--r--tests/check_framework/test_caches.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/check_framework/test_caches.py b/tests/check_framework/test_caches.py
index a3ddfd64e7..3b6b41d442 100644
--- a/tests/check_framework/test_caches.py
+++ b/tests/check_framework/test_caches.py
@@ -91,6 +91,35 @@ class CheckCacheLocationTest(SimpleTestCase):
with self.subTest(setting=setting), self.settings(**settings):
self.assertEqual(check_cache_location_not_exposed(None), [])
+ def test_staticfiles_dirs_prefix(self):
+ root = pathlib.Path.cwd()
+ tests = [
+ (root, root, 'matches'),
+ (root / 'cache', root, 'is inside'),
+ (root, root / 'other', 'contains'),
+ ]
+ for cache_path, setting_path, msg in tests:
+ settings = self.get_settings(
+ 'STATICFILES_DIRS',
+ cache_path,
+ ('prefix', setting_path),
+ )
+ with self.subTest(path=setting_path), self.settings(**settings):
+ msg = self.warning_message % (msg, 'STATICFILES_DIRS')
+ self.assertEqual(check_cache_location_not_exposed(None), [
+ Warning(msg, id='caches.W002'),
+ ])
+
+ def test_staticfiles_dirs_prefix_not_conflict(self):
+ root = pathlib.Path.cwd()
+ settings = self.get_settings(
+ 'STATICFILES_DIRS',
+ root / 'cache',
+ ('prefix', root / 'other'),
+ )
+ with self.settings(**settings):
+ self.assertEqual(check_cache_location_not_exposed(None), [])
+
class CheckCacheAbsolutePath(SimpleTestCase):
def test_absolute_path(self):