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

Method test_body_stored_inline

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

The body is stored together with the metadata.

(self, sess)

Source from the content-addressed store, hash-verified

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 3

_fnMethod · 0.80
readMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected