diff --git a/code/tests/test_welcome.py b/code/tests/test_welcome.py new file mode 100644 index 0000000..dfed778 --- /dev/null +++ b/code/tests/test_welcome.py @@ -0,0 +1,21 @@ +"""Cubre la ruta raíz `/`: página de bienvenida por defecto del Golden Path.""" + +from fastapi.testclient import TestClient + + +def test_root_serves_welcome_page(client: TestClient) -> None: + response = client.get("/") + assert response.status_code == 200 + assert "text/html" in response.headers.get("content-type", "") + body = response.text + # Mensaje clave: el desarrollo del tenant reemplaza esta página tras commit+push. + assert "commit" in body and "push" in body + assert "plataforma" in body.lower() + # En el template (sin renderizar) el placeholder sigue presente. + assert "__APP_NAME__" in body + + +def test_root_excluded_from_openapi_schema(client: TestClient) -> None: + # La welcome page no debe ensuciar el contrato OpenAPI del dev (include_in_schema=False). + schema = client.get("/openapi.json").json() + assert "/" not in schema.get("paths", {})