File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from backend .app import create_app
2+
3+ from fastapi import FastAPI
4+
5+ from httpx import ASGITransport
6+ from httpx import AsyncClient
7+
8+ import pytest
9+
10+
11+ @pytest .fixture
12+ def app () -> FastAPI :
13+ """Fixture to create a test app instance."""
14+ return create_app ()
15+
16+
17+ @pytest .mark .asyncio
18+ async def test_health_check (app : FastAPI ):
19+ """Test the /health endpoint returns a healthy status."""
20+ transport = ASGITransport (app = app )
21+ async with AsyncClient (transport = transport , base_url = "http://test" ) as ac :
22+ response = await ac .get ("/health" )
23+ assert response .status_code == 200
24+ assert response .json () == {"status" : "healthy" }
25+
26+
27+ @pytest .mark .asyncio
28+ async def test_backend_routes_exist (app : FastAPI ):
29+ """Ensure /api routes are available (smoke test)."""
30+ # Check available routes include /api prefix from backend_router
31+ routes = [route .path for route in app .router .routes ]
32+ backend_routes = [r for r in routes if r .startswith ("/api" )]
33+ assert backend_routes , "No backend routes found under /api prefix"
You can’t perform that action at this time.
0 commit comments