Files
agentci/tests/test_context.py
T
2026-07-19 12:21:26 +02:00

28 lines
893 B
Python

from agentci.adapters.gitea_models import CommentInfo, IssueInfo
from agentci.workflows.context import ContextBuilder
class FakeGitea:
async def issue(self, *_args):
return IssueInfo(number=2, title="Broken widget", body="It fails.", state="open")
async def issue_comments(self, *_args):
return [
CommentInfo(1, "alice", "Details", "2026-01-01"),
CommentInfo(2, "agentci", "Agent job queued", "2026-01-02"),
]
class FakeStorage:
async def operational_comment_ids(self, *_args):
return {2}
async def test_issue_context_excludes_operational_comments() -> None:
builder = ContextBuilder(FakeGitea(), FakeStorage()) # type: ignore[arg-type]
context = await builder.issue_context("org", "repo", 2)
assert "Broken widget" in context
assert "Details" in context
assert "Agent job queued" not in context