MCPcopy
hub / github.com/django/django / test_cache_dir_permissions

Method test_cache_dir_permissions

tests/cache/tests.py:1846–1862  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 4

valuesMethod · 0.45
sendMethod · 0.45
setMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected