Files
crucible-agent-create-commi…/tests/test_generator.py

31 lines
1.2 KiB
Python

import json
from application_landing_zone_agent.generator import generate, render_drawio, render_tsd
from application_landing_zone_agent.model import normalize
def test_normalize_and_tsd_include_contract_sections():
r = normalize({"name": "Orders", "requirements": ["place orders"], "security": ["SSO"], "custom": "kept"})
tsd = render_tsd(r)
assert "# Technical Solution Design: Orders" in tsd
assert "Functional requirements" in tsd
assert "SSO" in tsd
assert "custom" in tsd
def test_drawio_is_editable_xml_and_escapes_title():
xml = render_drawio(normalize({"name": "A & B"}))
assert xml.startswith("<?xml")
assert "A &amp; B" in xml
assert "mxGraphModel" in xml
assert 'source="service" target="store"' in xml
def test_generate_writes_artifacts_and_manifest(tmp_path):
result = generate({"name": "Payments", "summary": "Secure payments"}, tmp_path)
assert result["artifacts"] == ["technical-solution-design.md", "architecture.drawio"]
assert (tmp_path / "technical-solution-design.md").exists()
assert (tmp_path / "architecture.drawio").read_text().startswith("<?xml")
manifest = json.loads((tmp_path / "manifest.json").read_text())
assert manifest["sha256"] == result["sha256"]