dodil/erp-brick-purchasing

DODIL ERP brick: purchasing

tests/test_process.py

"""The process this brick serves is the process the customer signed (purchasing v8, 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_purchasing" / "application" / "process.yaml"
SPEC = pathlib.Path(__file__).resolve().parents[2] / "erp-method" / "modules" / "purchasing" / "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"] == 8
    for key in ("id", "name", "actors", "workflows"):
        assert served[key] == spec[key], key