| 1844 | "Windows only partially supports umasks and chmod.", |
| 1845 | ) |
| 1846 | def test_cache_dir_permissions(self): |
| 1847 | os.rmdir(self.dirname) |
| 1848 | dir_path = Path(self.dirname) / "nested" / "filebasedcache" |
| 1849 | for cache_params in settings.CACHES.values(): |
| 1850 | cache_params["LOCATION"] = dir_path |
| 1851 | setting_changed.send(self.__class__, setting="CACHES", enter=False) |
| 1852 | cache.set("foo", "bar") |
| 1853 | self.assertIs(dir_path.exists(), True) |
| 1854 | tests = [ |
| 1855 | dir_path, |
| 1856 | dir_path.parent, |
| 1857 | dir_path.parent.parent, |
| 1858 | ] |
| 1859 | for directory in tests: |
| 1860 | with self.subTest(directory=directory): |
| 1861 | dir_mode = directory.stat().st_mode & 0o777 |
| 1862 | self.assertEqual(dir_mode, 0o700) |
| 1863 | |
| 1864 | def test_get_does_not_ignore_non_filenotfound_exceptions(self): |
| 1865 | with mock.patch("builtins.open", side_effect=OSError): |