The body is stored together with the metadata.
(self, sess)
| 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 | |
| 144 | class TestSeparateBodyFileCache(FileCacheTestsMixin): |