test : add unit tests for health_check and root endpoint functions

Abierto
#2,273 1 comentario 0 reacciones 1 asignado Ver en GitHub

@tmdeveloper007 ya está trabajando en esto.

Desde el 3/8/2026.

  • #2278 de @tmdeveloper007 — cerrado sin fusionar

Evaluación

Este issue todavía no se ha evaluado.

Descripción

Summary of What Needs to be Done:
Add unit tests for the health_check and root endpoint functions in backend/secuscan/main.py. These are FastAPI route handlers that can be tested in isolation by constructing a minimal FastAPI app or by testing them as async functions with mocked dependencies.

Changes that Need to be Made:
Create testing/backend/unit/test_main_endpoints.py (standalone unit tests) covering:

  1. health_check():

    • Returns a JSONResponse with status field
    • Returns 200 status code
    • Response body contains expected fields (e.g., status, version)
  2. root():

    • Returns an HTMLResponse
    • Response has 200 status code
    • Response body contains expected HTML content

Use FastAPI TestClient or construct minimal app state for testing. Mock any app-level dependencies that are not relevant to these endpoints. Run with --noconftest to avoid the full app initialization.

Import from backend.secuscan.main directly. Do NOT import the full app (which requires all routes to be loaded).

Impact that it would Provide:

  • Reliability: Ensures health check and root endpoints return expected responses
  • Testing: Adds coverage for main.py which currently has no unit tests
  • Maintainability: Documents the expected API surface for these endpoints

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Lenguaje dominante
Python
Estrellas
36
Forks
234
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de utksh1/SecuScan

Todos los issues de utksh1/SecuScan

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.