diff --git a/backend/app/main.py b/backend/app/main.py index 560daa4..3f46f00 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -109,15 +109,14 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: ) # --- Routes --- -from app.api.routes import generate, health # noqa: E402 +from app.api.routes import export, generate, health, styles # noqa: E402 app.include_router(generate.router, prefix="/api", tags=["generation"]) app.include_router(health.router, tags=["health"]) # Optional: register export and styles routes when ready -# from app.api.routes import export, styles -# app.include_router(export.router, prefix="/api", tags=["export"]) -# app.include_router(styles.router, prefix="/api", tags=["styles"]) +app.include_router(export.router, prefix="/api", tags=["export"]) +app.include_router(styles.router, prefix="/api", tags=["styles"]) @app.get("/") diff --git a/backend/tests/test_api.py b/backend/tests/test_api.py index 150e0a9..c61e722 100644 --- a/backend/tests/test_api.py +++ b/backend/tests/test_api.py @@ -63,5 +63,14 @@ class TestExportEndpoint: def test_export_requires_job_id(self) -> None: """Should return 422 if job_id is missing.""" - # TODO: Implement - pass + response = client.post("/api/export", json={"format": "png"}) + assert response.status_code == 422 + + data = response.json() + assert "detail" in data + + # Check that job_id is the missing field + missing_fields = [ + error["loc"][-1] for error in data["detail"] if error["type"] == "missing" + ] + assert "job_id" in missing_fields