| | 94 | def test_staticfiles_dirs_prefix(self): |
| | 95 | root = pathlib.Path.cwd() |
| | 96 | tests = [ |
| | 97 | (root, root, 'matches'), |
| | 98 | (root / 'cache', root, 'is inside'), |
| | 99 | (root, root / 'other', 'contains'), |
| | 100 | ] |
| | 101 | for cache_path, setting_path, msg in tests: |
| | 102 | settings = self.get_settings( |
| | 103 | 'STATICFILES_DIRS', |
| | 104 | cache_path, |
| | 105 | ('prefix', setting_path), |
| | 106 | ) |
| | 107 | with self.subTest(path=setting_path), self.settings(**settings): |
| | 108 | msg = self.warning_message % (msg, 'STATICFILES_DIRS') |
| | 109 | self.assertEqual(check_cache_location_not_exposed(None), [ |
| | 110 | Warning(msg, id='caches.W002'), |
| | 111 | ]) |
| | 112 | |
| | 113 | def test_staticfiles_dirs_prefix_not_conflict(self): |
| | 114 | root = pathlib.Path.cwd() |
| | 115 | settings = self.get_settings( |
| | 116 | 'STATICFILES_DIRS', |
| | 117 | root / 'cache', |
| | 118 | ('prefix', root / 'other'), |
| | 119 | ) |
| | 120 | with self.settings(**settings): |
| | 121 | self.assertEqual(check_cache_location_not_exposed(None), []) |
| | 122 | |