Initial commit

This commit is contained in:
Warezpeddler
2026-04-25 23:09:31 +01:00
commit 3325436017
92 changed files with 18397 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
from applepy import catalog_cache
def test_load_loobins_entries_filters() -> None:
rows = catalog_cache.load_loobins_entries(
[
{"name": "curl", "paths": ["/usr/bin/curl"], "short_description": "x"},
{"bad": 1},
{"name": "", "paths": []},
]
)
assert len(rows) == 1
assert rows[0]["name"] == "curl"
def test_iter_gtfo_modern_api_shape() -> None:
data = {
"functions": {},
"contexts": {},
"executables": {
"7z": {"functions": {"Shell": {}}},
"apt": {"alias": "apt-get"},
},
}
out = catalog_cache.iter_gtfo_binaries(data)
assert out == [("7z", {"functions": {"Shell": {}}})]
def test_fetch_json_offline_uses_stale(tmp_path, monkeypatch) -> None:
monkeypatch.setattr(catalog_cache, "_cache_dir", lambda: tmp_path)
url = "https://example.test/x.json"
p = catalog_cache._cache_path(url)
p.write_text("[1]", encoding="utf-8")
parsed, status = catalog_cache.fetch_json_url(url, offline=True, max_age_hours=0)
assert parsed == [1]
assert "offline" in status