""" Tests for the main FastAPI application """ from fastapi.testclient import TestClient from main import app client = TestClient(app) class TestMainApp: """Test the main FastAPI application""" def test_app_creation(self): """Test that the FastAPI app is created correctly""" assert app is not None assert app.title == "LabFusion Service Adapters" assert app.version == "1.0.0" def test_cors_middleware(self): """Test that CORS middleware is properly configured""" # Test a simple request to verify CORS headers response = client.get("/") assert response.status_code == 200 # CORS headers should be present assert "access-control-allow-origin" in response.headers def test_routers_included(self): """Test that all routers are included""" # Check that all expected routes are available routes = [route.path for route in app.routes] # General routes assert "/" in routes assert "/health" in routes assert "/services" in routes # Other service routes should be included # (exact paths depend on router definitions) def test_openapi_docs(self): """Test that OpenAPI documentation is available""" response = client.get("/docs") assert response.status_code == 200 response = client.get("/openapi.json") assert response.status_code == 200 assert "openapi" in response.json()