integration layer; merge work on indicators from forks with existing ingestion pipeline
This commit is contained in:
+15
-13
@@ -1,25 +1,21 @@
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def client():
|
||||
db_path = tempfile.NamedTemporaryFile(suffix=".db", delete=False).name
|
||||
os.environ["CACU_DATABASE_URL"] = f"sqlite:///{db_path}"
|
||||
def client(wire_domain):
|
||||
wire_domain("cacu")
|
||||
|
||||
from datetime import date
|
||||
|
||||
from core.cacu.base import CaCuModel
|
||||
from core.cacu.models import Paciente
|
||||
from persistance.db import get_cacu_engine
|
||||
from persistance import db as persistance_db
|
||||
|
||||
engine = get_cacu_engine()
|
||||
CaCuModel.metadata.create_all(engine)
|
||||
engine = persistance_db.get_cacu_engine()
|
||||
|
||||
from sqlmodel import Session
|
||||
|
||||
with Session(engine) as session:
|
||||
session.add(Paciente(pac_id_hospital="H-1", pac_sexo="Femenino"))
|
||||
session.add(Paciente(pac_id_hospital="H-1", pac_sexo="Femenino", pac_fecha_nacimiento=date(1990, 1, 1)))
|
||||
session.commit()
|
||||
|
||||
from webapi import create_app
|
||||
@@ -29,8 +25,6 @@ def client():
|
||||
with app.test_client() as client:
|
||||
yield client
|
||||
|
||||
os.unlink(db_path)
|
||||
|
||||
|
||||
def test_health(client):
|
||||
response = client.get("/health")
|
||||
@@ -52,3 +46,11 @@ def test_get_paciente_not_found(client):
|
||||
def test_predict_not_implemented(client):
|
||||
response = client.post("/cacu/predict")
|
||||
assert response.status_code == 501
|
||||
|
||||
|
||||
def test_api_index_lists_routes_with_summaries():
|
||||
from webapi import create_app
|
||||
|
||||
routes = {r["path"]: r for r in create_app().test_client().get("/api").get_json()["routes"]}
|
||||
assert routes["/imports/connectors"]["methods"] == ["GET"]
|
||||
assert routes["/governance/model-versions/<domain>/<scenario>/<version>/promote"]["summary"].startswith("Puts the version in production")
|
||||
|
||||
Reference in New Issue
Block a user