import json import pytest def test_parse_export_probe_requires_all_known_exports(): from cbb_refresh_verify.verify_probe import parse_export_probe payload = { "ok": True, "probe": "exports", "dll_path": r"D:\Mentor\LMCDLL70.dll", "architecture": "x86", "exports": { "IsVerifiedReuseBlock": {"found": True, "address": "0x100544e0"}, "GetStatusRBInContextOfCL": {"found": True, "address": "0x1006ddc0"}, "VerifyReuseBlock": {"found": True, "address": "0x10057840"}, "UnVerifyReuseBlock": {"found": True, "address": "0x10061b40"}, "GetReusableCircuitVerificationStatus": {"found": True, "address": "0x20019c30"}, }, "write_call": {"enabled": False, "reason": "CFilename ABI not reconstructed"}, } result = parse_export_probe(json.dumps(payload)) assert result.architecture == "x86" assert result.export("VerifyReuseBlock").found is True assert result.write_enabled is False def test_parse_export_probe_rejects_write_enabled_payload(): from cbb_refresh_verify.verify_probe import ProbeResponseError, parse_export_probe payload = { "ok": True, "probe": "exports", "dll_path": "LMCDLL70.dll", "architecture": "x86", "exports": {}, "write_call": {"enabled": True, "reason": "unsafe"}, } with pytest.raises(ProbeResponseError, match="写接口探测桥不能启用写调用"): parse_export_probe(json.dumps(payload))