mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
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.
90 lines
2.6 KiB
Python
90 lines
2.6 KiB
Python
"""Kanban API route coverage."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
import pytest
|
|
import pytest_asyncio
|
|
from fastapi import FastAPI
|
|
from httpx import ASGITransport, AsyncClient
|
|
from roboco.api.deps import get_db
|
|
from roboco.api.routes.kanban import router as kanban_router
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import AsyncIterator
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
|
|
@pytest_asyncio.fixture
|
|
async def kanban_client(
|
|
db_session: AsyncSession,
|
|
) -> AsyncIterator[AsyncClient]:
|
|
app = FastAPI()
|
|
app.include_router(kanban_router, prefix="/api/kanban")
|
|
|
|
async def _override_db():
|
|
yield db_session
|
|
|
|
app.dependency_overrides[get_db] = _override_db
|
|
|
|
transport = ASGITransport(app=app)
|
|
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
|
yield client
|
|
app.dependency_overrides.clear()
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_dev_board(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/dev/backend")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_qa_board(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/qa/backend")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_documenter_board(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/documenter/backend")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_pm_board(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/pm/backend")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_main_pm_board(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/main-pm")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_main_pm_board_flat(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/main-pm?flat=true")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_board_kanban(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/board")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_kanban_stats(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/stats")
|
|
assert response.status_code == 200
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_dev_board_with_swimlane(kanban_client: AsyncClient) -> None:
|
|
response = await kanban_client.get("/api/kanban/dev/backend?swimlane_by=priority")
|
|
assert response.status_code == 200
|