refactor tests
Publish container image / Build and push (push) Successful in 32s

This commit is contained in:
2026-07-26 23:49:40 +02:00
parent 5ef10d28fe
commit ce9f1e3d20
32 changed files with 1546 additions and 1923 deletions
+47 -26
View File
@@ -59,32 +59,53 @@ def test_agent_and_final_comments_preserve_protocol_marker() -> None:
)
def test_pull_request_body_and_result_comment_render_validation() -> None:
result = AgentResult(
summary_markdown="Implemented the widget fix.",
tests=["pytest: passed", "ruff: passed"],
)
assert pull_request_body(17, result) == (
"Closes #17\n\n"
"## Implementation\n\nImplemented the widget fix.\n\n"
"## Validation\n\n- pytest: passed\n- ruff: passed\n\n"
"_Created by Agent CI._"
)
assert result_comment(result, sha="abc123") == (
"## Agent result\n\nImplemented the widget fix.\n\n"
"## Validation\n\n- pytest: passed\n- ruff: passed\n\n"
"Commit: `abc123`"
)
def test_renderers_report_missing_validation() -> None:
result = AgentResult(summary_markdown="Applied the change.", tests=[])
assert "## Validation\n\n- Not reported" in pull_request_body(2, result)
assert result_comment(result) == (
"## Agent result\n\nApplied the change.\n\n## Validation\n\n- Not reported"
)
@pytest.mark.parametrize(
("issue_number", "result", "sha", "expected_body", "expected_comment"),
[
pytest.param(
17,
AgentResult(
summary_markdown="Implemented the widget fix.",
tests=["pytest: passed", "ruff: passed"],
),
"abc123",
(
"Closes #17\n\n"
"## Implementation\n\nImplemented the widget fix.\n\n"
"## Validation\n\n- pytest: passed\n- ruff: passed\n\n"
"_Created by Agent CI._"
),
(
"## Agent result\n\nImplemented the widget fix.\n\n"
"## Validation\n\n- pytest: passed\n- ruff: passed\n\n"
"Commit: `abc123`"
),
id="reported-validation",
),
pytest.param(
2,
AgentResult(summary_markdown="Applied the change.", tests=[]),
None,
(
"Closes #2\n\n"
"## Implementation\n\nApplied the change.\n\n"
"## Validation\n\n- Not reported\n\n"
"_Created by Agent CI._"
),
"## Agent result\n\nApplied the change.\n\n## Validation\n\n- Not reported",
id="missing-validation",
),
],
)
def test_result_renderers_render_reported_and_missing_validation(
issue_number: int,
result: AgentResult,
sha: str | None,
expected_body: str,
expected_comment: str,
) -> None:
assert pull_request_body(issue_number, result) == expected_body
assert result_comment(result, sha=sha) == expected_comment
@pytest.mark.parametrize(