MCPcopy Create free account
hub / github.com/psf/cachecontrol / TestFileCache

Class TestFileCache

tests/test_storage_filecache.py:121–141  ·  view source on GitHub ↗

Tests for ``FileCache``.

Source from the content-addressed store, hash-verified

119
120
121class TestFileCache(FileCacheTestsMixin):
122 """
123 Tests for ``FileCache``.
124 """
125
126 FileCacheClass = FileCache
127
128 def test_body_stored_inline(self, sess):
129 """The body is stored together with the metadata."""
130 url = self.url + "cache_60"
131 response = sess.get(url)
132 body = response.content
133 response2 = sess.get(url)
134 assert response2.from_cache
135 assert response2.content == body
136
137 # OK now let's violate some abstraction boundaries to make sure body
138 # was stored in metadata file.
139 with open(self.cache._fn(url), "rb") as f:
140 assert body in f.read()
141 assert not os.path.exists(self.cache._fn(url) + ".body")
142
143
144class TestSeparateBodyFileCache(FileCacheTestsMixin):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…