Files
Aidem-Media-DLL-Analysis/tests/test_inventory.py
T
Patryk GenschandClaude Opus 5.5 b0013c5114 feat(acquire): resumable batch extraction queue and binary inventory
Inventory classifies the DLL repository by SHA; the batch queue runs each
engine build in a fresh PyGhidra process with a timeout, fingerprints the
extractor environment and keeps per-attempt state and logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 18:24:15 +02:00

20 lines
1005 B
Python

import hashlib
import json
from ams.inventory import inventory
def test_inventory_hashes_actual_bytes_and_preserves_aliases(tmp_path):
(tmp_path / "Game__falsehash__PIKLIB8.DLL").write_bytes(b"same")
(tmp_path / "Other__falsehash__PIKLIB8.DLL").write_bytes(b"same")
(tmp_path / "Game__falsehash__PIKLIB61.DLL").write_bytes(b"different")
(tmp_path / "Game [piklib72]__falsehash__SEKAI.DLL").write_bytes(b"sekai")
(tmp_path / "PIKLIB41.DLL").write_bytes(b"old")
sha = hashlib.sha256(b"same").hexdigest()
(tmp_path / "test.snapshot.json").write_text(json.dumps({"binary":{"sha256":sha}}))
result = inventory([tmp_path],tmp_path)
assert result["summary"] == {"files":5,"unique":4,"by_scope":{"engine":2,"native_dependency":1,"excluded_early_engine":1}}
same = next(b for b in result["builds"] if b["sha256"] == sha)
assert len(same["paths"]) == 2
assert same["analysis"] == "snapshot_available"
assert same["suggested_snapshot"] == sha + ".snapshot.json"