MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / test_mirror_cache_paths

Function test_mirror_cache_paths

tests/test_cache.py:103–130  ·  view source on GitHub ↗
(file_path, fixtures, mock_cache)

Source from the content-addressed store, hash-verified

101 "sarif-schema.json"
102))
103def test_mirror_cache_paths(file_path, fixtures, mock_cache):
104 pth = Path(fixtures.path(file_path))
105 exc = RuntimeError("failed")
106 assert pth.exists()
107
108 mock_pth = mock.Mock(spec=pth, wraps=pth)
109 mock_pth.exists.side_effect = exc
110 mock_pth.name = pth.name
111
112 cached = cache.MirrorFile.proxy(src=pth)
113 assert cached != pth
114 assert cached != mock_pth
115
116 with mock.patch.object(cache.MirrorFile, "fetch", side_effect=exc):
117 cached2 = cache.MirrorFile.proxy(src=mock_pth)
118
119 assert cached2 == cached
120
121 cache_obj = cache.MirrorFile(src=pth)
122 assert cache_obj.is_valid is True
123 assert cache_obj.cache_file_location == cached
124 assert cache_obj.cache_file_location.exists()
125 assert cache_obj.metadata_location.exists()
126
127 cache_obj.delete()
128 assert not cache_obj.cache_file_location.exists()
129 assert not cache_obj.metadata_location.exists()
130 assert cache_obj.is_valid is False
131
132
133def test_mirror_no_remote_access(simulate_mirror, mock_cache):

Callers

nothing calls this directly

Calls 4

pathMethod · 0.80
existsMethod · 0.45
proxyMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected