33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
import json
|
|
import xml.etree.ElementTree as ET
|
|
from application_landing_zone_agent import ApplicationLandingZoneAgent
|
|
|
|
|
|
def payload():
|
|
return {"application_name": "Demo <Portal>", "business_objective": "Serve users", "environments": ["dev", "prod"], "requirements": ["R1"]}
|
|
|
|
|
|
def test_generates_all_artifacts(tmp_path):
|
|
result = ApplicationLandingZoneAgent().generate(payload(), tmp_path)
|
|
assert (tmp_path / "tsd.md").exists()
|
|
assert "Demo <Portal>" in result.tsd
|
|
assert "## 5. Security" in result.tsd
|
|
assert (tmp_path / "manifest.json").exists()
|
|
ET.fromstring(result.diagram)
|
|
assert "mxGraphModel" in result.diagram
|
|
|
|
|
|
def test_input_validation(tmp_path):
|
|
try:
|
|
ApplicationLandingZoneAgent().generate({"application_name": "x"}, tmp_path)
|
|
except ValueError as exc:
|
|
assert "business_objective" in str(exc)
|
|
else:
|
|
raise AssertionError("invalid input accepted")
|
|
|
|
|
|
def test_manifest_is_json(tmp_path):
|
|
ApplicationLandingZoneAgent().generate(payload(), tmp_path)
|
|
manifest = json.loads((tmp_path / "manifest.json").read_text())
|
|
assert set(manifest["artifacts"]) == {"tsd", "drawio"}
|