test: lift coverage 41% → 76% (+1068 tests across 36 files)

Service-level tests now exercise provider, permissions, project, journal,
messaging, work_session, metrics, kanban, extraction, learning, notification,
dashboard, llm_routing, a2a, task, repository_base, audit, db_seed,
branch_name, indexed_document, query_helpers, agent. API route tests cover
provider, journal, project, sessions, dashboard, work_session, tasks, a2a,
groups, notifications, agents, channels, messages, kanban, api_resources.
Pure-function helpers covered: handlers, deps_helpers, middleware,
middleware_docs, transcription, pr templates, agents_config, errors,
logging, journal/notification/channel/a2a access, task_lifecycle,
streaming, converters, crypto, schemas (common + websocket), events,
permissions extras.

pyproject ruff per-file-ignores extended for tests so PLR2004 (status code
magic values), PLC0415 (lazy imports), PLR0913 (fixture params), ARG001
(unused fixture deps), SIM105, and E501 don't fight test idioms.
This commit is contained in:
Renn F
2026-05-06 00:32:52 +02:00
parent b6903490f1
commit 64c48356d0
46 changed files with 2994 additions and 206 deletions
+6 -14
View File
@@ -8,7 +8,7 @@ mapping) is exercised end-to-end.
from __future__ import annotations
from typing import TYPE_CHECKING
from uuid import uuid4
from uuid import UUID, uuid4
import pytest
import pytest_asyncio
@@ -207,7 +207,7 @@ async def test_get_my_growth_metrics(
@pytest_asyncio.fixture
async def journal_setup_with_task(
db_session: AsyncSession,
) -> "AsyncIterator[tuple[AsyncClient, AgentTable, UUID]]":
) -> AsyncIterator[tuple[AsyncClient, AgentTable, UUID]]:
from roboco.db.tables import ProjectTable, TaskTable
from roboco.models.base import TaskNature, TaskStatus, TaskType
@@ -348,9 +348,7 @@ async def test_get_entry_not_found(
journal_client: tuple[AsyncClient, AgentTable],
) -> None:
client, _ = journal_client
response = await client.get(
f"/api/journals/entries/{uuid4()}", headers=_HDR
)
response = await client.get(f"/api/journals/entries/{uuid4()}", headers=_HDR)
assert response.status_code == 404
@@ -359,9 +357,7 @@ async def test_delete_entry_not_found(
journal_client: tuple[AsyncClient, AgentTable],
) -> None:
client, _ = journal_client
response = await client.delete(
f"/api/journals/entries/{uuid4()}", headers=_HDR
)
response = await client.delete(f"/api/journals/entries/{uuid4()}", headers=_HDR)
assert response.status_code == 404
@@ -390,9 +386,7 @@ async def test_list_agent_entries_unknown_agent(
journal_client: tuple[AsyncClient, AgentTable],
) -> None:
client, _ = journal_client
response = await client.get(
f"/api/journals/{uuid4()}/entries", headers=_HDR
)
response = await client.get(f"/api/journals/{uuid4()}/entries", headers=_HDR)
assert response.status_code in (404, 403)
@@ -402,9 +396,7 @@ async def test_list_agent_entries_for_self(
) -> None:
client, agent = journal_client
await client.get("/api/journals/me", headers=_HDR)
response = await client.get(
f"/api/journals/{agent.id}/entries", headers=_HDR
)
response = await client.get(f"/api/journals/{agent.id}/entries", headers=_HDR)
assert response.status_code in (200, 403)