def test_safe_get_no_perms(self, cache_tmpdir, monkeypatch): os.chmod(cache_tmpdir, 000) monkeypatch.setattr(os.path, "exists", lambda x: True) cache = SafeFileCache(cache_tmpdir) cache.get("foo")
def test_safe_get_no_perms(self, cache_tmpdir, monkeypatch): os.chmod(cache_tmpdir, 000) monkeypatch.setattr(os.path, "exists", lambda x: True) cache = SafeFileCache(cache_tmpdir) cache.get("foo")
def test_cache_roundtrip(self, cache_tmpdir): cache = SafeFileCache(cache_tmpdir) assert cache.get("test key") is None cache.set("test key", b"a test string") assert cache.get("test key") == b"a test string" cache.delete("test key") assert cache.get("test key") is None
def test_cache_roundtrip(self, cache_tmpdir): cache = SafeFileCache(cache_tmpdir) assert cache.get("test key") is None cache.set("test key", b"a test string") assert cache.get("test key") == b"a test string" cache.delete("test key") assert cache.get("test key") is None
def test_safe_get_no_perms(self, tmpdir, monkeypatch): cache_dir = tmpdir.join("unreadable-cache") cache_dir.makedirs() os.chmod(cache_dir, 000) monkeypatch.setattr(os.path, "exists", lambda x: True) cache = SafeFileCache(cache_dir) cache.get("foo")
def test_safe_get_no_perms(self, tmpdir, monkeypatch): cache_dir = tmpdir.join("unreadable-cache") cache_dir.makedirs() os.chmod(cache_dir, 000) monkeypatch.setattr(os.path, "exists", lambda x: True) cache = SafeFileCache(cache_dir) cache.get("foo")
def test_cache_roundtrip(self, tmpdir): cache_dir = tmpdir.join("test-cache") cache_dir.makedirs() cache = SafeFileCache(cache_dir) assert cache.get("test key") is None cache.set("test key", b"a test string") assert cache.get("test key") == b"a test string" cache.delete("test key") assert cache.get("test key") is None
def test_cache_roundtrip(self, tmpdir): cache_dir = tmpdir.join("test-cache") cache_dir.makedirs() cache = SafeFileCache(cache_dir) assert cache.get("test key") is None cache.set("test key", b"a test string") assert cache.get("test key") == b"a test string" cache.delete("test key") assert cache.get("test key") is None