Ejemplo n.º 1
0
 def test_cache_path_not_conflict(self):
     root = pathlib.Path.cwd()
     for setting in ('MEDIA_ROOT', 'STATIC_ROOT', 'STATICFILES_DIRS'):
         settings = self.get_settings(setting, root / 'cache',
                                      root / 'other')
         with self.subTest(setting=setting), self.settings(**settings):
             self.assertEqual(check_cache_location_not_exposed(None), [])
Ejemplo n.º 2
0
 def test_cache_path_contains_media_static_setting(self):
     root = pathlib.Path.cwd()
     for setting in ('MEDIA_ROOT', 'STATIC_ROOT', 'STATICFILES_DIRS'):
         settings = self.get_settings(setting, root, root / 'other')
         with self.subTest(setting=setting), self.settings(**settings):
             msg = self.warning_message % ('contains', setting)
             self.assertEqual(check_cache_location_not_exposed(None), [
                 Warning(msg, id='caches.W002'),
             ])
Ejemplo n.º 3
0
 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), [])
Ejemplo n.º 4
0
 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), [])
Ejemplo n.º 5
0
 def test_cache_path_contains_media_static_setting(self):
     root = pathlib.Path.cwd()
     for setting in ("MEDIA_ROOT", "STATIC_ROOT", "STATICFILES_DIRS"):
         settings = self.get_settings(setting, root, root / "other")
         with self.subTest(setting=setting), self.settings(**settings):
             msg = self.warning_message % ("contains", setting)
             self.assertEqual(
                 check_cache_location_not_exposed(None),
                 [
                     Warning(msg, id="caches.W002"),
                 ],
             )
Ejemplo n.º 6
0
 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'),
             ])
Ejemplo n.º 7
0
 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"),
                 ],
             )