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

Function test_mirror_no_remote_access

tests/test_cache.py:133–159  ·  view source on GitHub ↗
(simulate_mirror, mock_cache)

Source from the content-addressed store, hash-verified

131
132
133def test_mirror_no_remote_access(simulate_mirror, mock_cache):
134 uri = "mirror://wheel"
135 exc = RuntimeError("test failed")
136
137 assert str(mirror.LocalMirror.get_mirror_path()) == simulate_mirror
138 assert cache.MirrorFile.get_location() is not None
139
140 handler = URIHandler.from_uri(uri)
141 paths = tuple(handler.get_paths())
142 assert len(paths) > 0
143
144 for path in paths:
145 assert path.location.exists()
146 path = str(path.location)
147 assert not path.startswith(simulate_mirror)
148
149
150 with ExitStack() as stack:
151 # Mock any remote file access functionality to throw an exception
152 shutil_mock = stack.enter_context(mock.patch("aura.cache.shutil"))
153 shutil_mock.copyfile.side_effect = exc
154 fetch_mock = stack.enter_context(mock.patch("aura.cache.MirrorFile.fetch", side_effect=exc))
155
156 handler_cached = URIHandler.from_uri(uri)
157 paths_cached = tuple(handler_cached.get_paths())
158
159 assert paths == paths_cached
160
161
162@mock.patch("aura.cache.get_cache_threshold")

Callers

nothing calls this directly

Calls 5

get_mirror_pathMethod · 0.80
get_locationMethod · 0.80
from_uriMethod · 0.45
get_pathsMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected