MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / test_filedownload_caching

Function test_filedownload_caching

tests/test_cache.py:235–250  ·  view source on GitHub ↗
(mock_cache)

Source from the content-addressed store, hash-verified

233
234@responses.activate
235def test_filedownload_caching(mock_cache):
236 payload = b"this is some file payload"
237 url = "https://url_cache_test.example.com/some_file.tgz"
238 fd = io.BytesIO()
239
240 responses.add(responses.GET, url, body=payload, status=200, stream=True)
241
242 cache.FileDownloadCache.proxy(url=url, fd=fd)
243 assert fd.getvalue() == payload
244
245 cache_items = tuple(cache.CacheItem.iter_items())
246 assert len(cache_items) == 1
247 assert cache_items[0].metadata["url"] == url
248
249 cache.CacheItem.cleanup()
250 assert len(tuple(cache.CacheItem.iter_items())) == 0
251
252
253@mock.patch("aura.cache.PyPIPackageList._get_package_list")

Callers

nothing calls this directly

Calls 3

iter_itemsMethod · 0.80
proxyMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected