30 lines
988 B
Python
30 lines
988 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from engine.devops_agent.spec import WorkflowSpecError, load_workflow_spec
|
||
|
|
|
||
|
|
|
||
|
|
def test_load_workflow_spec_splits_frontmatter_and_body() -> None:
|
||
|
|
spec = load_workflow_spec(Path("tests/fixtures/specs/valid_workflow.md"))
|
||
|
|
|
||
|
|
assert spec.name == "issue-delivery"
|
||
|
|
assert spec.provider == "gitea"
|
||
|
|
assert spec.frontmatter["safe_outputs"]["add_comment"]["max"] == 2
|
||
|
|
assert "Read the selected issue" in spec.body
|
||
|
|
|
||
|
|
|
||
|
|
def test_load_workflow_spec_rejects_missing_provider() -> None:
|
||
|
|
with pytest.raises(WorkflowSpecError, match="provider"):
|
||
|
|
load_workflow_spec(Path("tests/fixtures/specs/invalid_missing_provider.md"))
|
||
|
|
|
||
|
|
|
||
|
|
def test_sample_workflow_spec_exists_and_loads() -> None:
|
||
|
|
spec = load_workflow_spec(Path("workflows/gitea-issue-delivery.md"))
|
||
|
|
|
||
|
|
assert spec.name == "gitea-issue-delivery"
|
||
|
|
assert spec.provider == "gitea"
|
||
|
|
assert "add_comment" in spec.frontmatter["safe_outputs"]
|