27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
DOCS = Path(__file__).resolve().parents[1] / "docs"
|
|
FMAP = DOCS / "ERP_FISCAL_FIELD_MAP_V1.json"
|
|
pytestmark = pytest.mark.skipif(not FMAP.exists(), reason="field map artifact not generated")
|
|
|
|
WRITABLE = {"IPI", "EX_TIPI", "CEST"}
|
|
|
|
|
|
def test_only_proven_product_fields_are_write_candidates():
|
|
fields = json.loads(FMAP.read_text(encoding="utf-8"))["fields"]
|
|
for f in fields:
|
|
if f["write_candidate"]:
|
|
assert f["table"] == "C000025" and f["field"] in WRITABLE and f["confidence"] == "HIGH"
|
|
if f["usage_class"] in ("LEGACY_UNUSED", "UNKNOWN") or f["confidence"] == "LOW":
|
|
assert not f["write_candidate"]
|
|
|
|
|
|
def test_every_context_input_has_a_known_status():
|
|
doc = json.loads((DOCS / "FISCAL_CONTEXT_REQUIREMENTS_V1.json").read_text(encoding="utf-8"))
|
|
allowed = {"AVAILABLE_FROM_ERP", "AVAILABLE_FROM_AGENT_CONFIG", "AVAILABLE_FROM_JOB", "MISSING"}
|
|
for dom in doc["domains"].values():
|
|
assert {i["status"] for i in dom["inputs"].values()} <= allowed
|