(pkg_list_mock, mock_cache)
| 252 | |
| 253 | @mock.patch("aura.cache.PyPIPackageList._get_package_list") |
| 254 | def test_pypi_cache(pkg_list_mock, mock_cache): |
| 255 | pkgs = ["pkg1", "pkg2", "pkg3"] |
| 256 | pkg_list_mock.return_value = pkgs |
| 257 | |
| 258 | output = cache.PyPIPackageList.proxy() |
| 259 | assert output == pkgs |
| 260 | assert pkg_list_mock.called is True |
| 261 | pkg_list_mock.reset_mock() |
| 262 | |
| 263 | output = cache.PyPIPackageList.proxy() |
| 264 | assert output == pkgs |
| 265 | assert pkg_list_mock.called is False |
| 266 | |
| 267 | cache_items = tuple(cache.CacheItem.iter_items()) |
| 268 | assert len(cache_items) == 1 |
| 269 | assert cache_items[0].metadata["type"] == "pypi_package_list" |
| 270 | |
| 271 | cache.CacheItem.cleanup() |
| 272 | assert len(tuple(cache.CacheItem.iter_items())) == 0 |
| 273 | |
| 274 | |
| 275 | @mock.patch("aura.cache.ASTPatternCache.get_patterns_hash", return_value="sig1") |
nothing calls this directly
no test coverage detected