TEA: un KeyError interno de la figura no se vuelve 404
KeyError es subclase de LookupError. El except LookupError de la ruta convertía cualquier error interno del kit en un 404 con su mensaje. Ahora solo un periodo sin reporte da 404; lo demás es un error del servidor.
This commit is contained in:
@@ -110,3 +110,14 @@ def test_paciente_por_id_entero(client):
|
||||
assert response.get_json()["pac_id_hospital"] == "T-01"
|
||||
|
||||
assert client.get("/tea/pacientes/abc").status_code == 404
|
||||
|
||||
|
||||
def test_un_keyerror_interno_no_se_vuelve_404(client, monkeypatch):
|
||||
from webapi.blueprints import tea
|
||||
|
||||
def falla(*args, **kwargs):
|
||||
raise KeyError("columna")
|
||||
|
||||
monkeypatch.setattr(tea, "figura_json_tea", falla)
|
||||
with pytest.raises(KeyError):
|
||||
_figura(client, "K01_evaluacion_3_meses", "fig_c1_grupos", "?periodos=2025-S1")
|
||||
|
||||
Reference in New Issue
Block a user