54 lines
1.5 KiB
Python
54 lines
1.5 KiB
Python
"""Tests for API route registration and root endpoints."""
|
|
|
|
from app.main import app
|
|
|
|
|
|
def test_root_endpoint():
|
|
"""Test root endpoint returns correct info."""
|
|
routes = {r.path for r in app.routes if hasattr(r, "methods")}
|
|
assert "/" in routes
|
|
assert "/health" in routes
|
|
assert "/api/v1/health" in routes
|
|
|
|
|
|
def test_all_api_routes_registered():
|
|
"""Test all expected API v1 routes are registered."""
|
|
routes = {r.path for r in app.routes if hasattr(r, "methods")}
|
|
|
|
expected = {
|
|
"/api/v1/auth/register",
|
|
"/api/v1/auth/login",
|
|
"/api/v1/auth/refresh",
|
|
"/api/v1/auth/oauth/{provider}",
|
|
"/api/v1/auth/oauth/{provider}/callback",
|
|
"/api/v1/users/me",
|
|
"/api/v1/ideas/",
|
|
"/api/v1/ideas/{idea_id}",
|
|
"/api/v1/ideas/{idea_id}/analyze",
|
|
"/api/v1/agents/",
|
|
"/api/v1/agents/{agent_name}",
|
|
"/api/v1/agents/{agent_name}/run",
|
|
"/api/v1/sync/pull",
|
|
"/api/v1/sync/push",
|
|
"/api/v1/admin/users",
|
|
"/api/v1/admin/users/{user_id}/role",
|
|
"/api/v1/admin/health",
|
|
"/api/v1/admin/logs",
|
|
}
|
|
|
|
for path in expected:
|
|
assert path in routes, f"Missing route: {path}"
|
|
|
|
|
|
def test_openapi_schema():
|
|
"""Test OpenAPI schema is generated."""
|
|
schema = app.openapi()
|
|
assert "VoIdea" in schema["info"]["title"]
|
|
assert "paths" in schema
|
|
assert len(schema["paths"]) >= 20
|
|
|
|
|
|
def test_app_title():
|
|
"""Test app has correct title."""
|
|
assert "VoIdea" in app.title
|