dodil/erp-brick-inventory

DODIL ERP brick: inventory

tests/test_process.py

"""The process this brick serves is the process the customer signed (inventory v6, erp-method): process.yaml is module.yaml's
version, actors and workflows, copied. A change goes through a new signature first, then the code."""
import pathlib

import pytest
import yaml

PROCESS = pathlib.Path(__file__).resolve().parents[1] / "src" / "brick_inventory" / "application" / "process.yaml"
SPEC = pathlib.Path(__file__).resolve().parents[2] / "erp-method" / "modules" / "inventory" / "module.yaml"


@pytest.mark.skipif(not SPEC.exists(), reason="erp-method is not checked out beside this brick")
def test_the_served_process_is_the_signed_module_yaml():
    served, spec = yaml.safe_load(PROCESS.read_text()), yaml.safe_load(SPEC.read_text())
    assert served["version"] == spec["version"] == 6
    for key in ("id", "name", "actors", "workflows"):
        assert served[key] == spec[key], key