"""Journey Matcher demo test — Delta -> Journey on the real transition patterns. Pins that the matcher, given ONLY a real Capability Delta (a multi-cert company wanting CRA + MaschinenVO), correctly ranks the known journeys by explanatory power: the convergence journey explains the whole delta, the CRA-only journey explains the security part but misses the machine- safety capabilities, and the TISAX journey is irrelevant. End-to-end through the real engines. """ from __future__ import annotations import os import subprocess import sys def _run(): root = os.path.join(os.path.dirname(__file__), "..") r = subprocess.run( [sys.executable, "reference_scenarios/journey_matcher_demo.py"], cwd=root, env={**os.environ, "PYTHONPATH": "."}, capture_output=True, text=True, ) assert r.returncode == 0, r.stderr return r.stdout def test_runs_end_to_end(): out = _run() assert "Journey Matcher" in out assert "Goal → Required → Delta → Journey" in out def test_convergence_journey_explains_the_whole_delta(): out = _run() assert "**ISO27001 -> CRA + MaschinenVO** | 9 von 9 fehlenden Capabilities | 100% |" in out def test_partial_journey_misses_machine_safety(): out = _run() # CRA-only journey explains the security part but not the MaschinenVO capabilities assert "**ISO27001 -> CRA** | 5 von 9 fehlenden Capabilities | 56% |" in out def test_irrelevant_journey_scores_zero(): out = _run() assert "**ISMS -> TISAX** | 0 von 9 fehlenden Capabilities | 0% |" in out def test_match_is_auditable(): out = _run() assert "auditierbar, keine Blackbox" in out assert "Erklärte Capabilities" in out