From 1e878b894258b40a7adf15adc184b6585f28889f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o?= Date: Fri, 27 Nov 2026 14:02:09 -0600 Subject: [PATCH] Erick's site as one table, ResultadoSubrogado --- tests/test_conectar.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/test_conectar.py b/tests/test_conectar.py index 8696de9..606501b 100644 --- a/tests/test_conectar.py +++ b/tests/test_conectar.py @@ -36,20 +36,22 @@ def test_an_operator_connects_a_site_and_settles_its_review(api, platform, site, # What the site has, and what one of its tables holds (documents shown by size). found = ok(api.post("/ingest/sources/resources", json={"source": SQL, "args": database})) - assert found == ["ArchivosUni", "ResultadosSubrogados"] + assert found == ["ResultadoSubrogado"] missing = {"credentials": "mssql+pymssql://sa:x@nowhere.invalid:1433/Pruebas"} unreachable = api.post("/ingest/sources/resources", json={"source": SQL, "args": missing}) assert unreachable.status_code == 422, unreachable.text reports = {"id": "reports", "kind": "source", "source": SQL, "args": database} sample = ok( - api.post("/ingest/sources/preview?limit=3", json=reports | {"resource": "ArchivosUni"}) + api.post( + "/ingest/sources/preview?limit=3", json=reports | {"resource": "ResultadoSubrogado"} + ) ) assert len(sample) == 3 and all(r["Archivo"].endswith(" bytes>") for r in sample) # A file someone uploads (a report sent by mail) becomes a source like any other. engine = create_engine(site.url) with engine.connect() as con: - pdf = con.execute(text("select Archivo from dbo.ArchivosUni where Id = 1")).scalar() + pdf = con.execute(text("select Archivo from dbo.ResultadoSubrogado where Id = 1")).scalar() engine.dispose() uploaded = ok(api.post("/ingest/uploads", files={"file": ("informe.pdf", pdf)})) mailed = { @@ -96,12 +98,12 @@ def test_an_operator_connects_a_site_and_settles_its_review(api, platform, site, # Run it, and look at what any node produced. run(api, "site") record_of = {} - for table, node in (("ArchivosUni", "archivos"), ("ResultadosSubrogados", "subrogados")): - rows = ok(api.get(f"/ingest/pipelines/site/nodes/{node}/rows?limit=500")) - record_of |= {f"{table}:{r['id']}": r["_record"] for r in rows} + assert ok(api.get("/ingest/pipelines/site/nodes/resultados/rows?limit=3")) + held_by = platform.query("select id, _record from bronze.n__site__resultados") + record_of |= {f"ResultadoSubrogado:{i}": r for i, r in held_by} assert len(record_of) == len(truth) - forms = sum(1 for r in truth if r["where"].startswith("ArchivosUni:") - and r["entity"] == "cervical_cytology") # fmt: skip + forms = sum(1 for r in truth + if r["entity"] == "cervical_cytology" and "document" not in r) # fmt: skip assert len(ok(api.get("/ingest/pipelines/site/nodes/cytology/rows?limit=500"))) == forms # Review: reports that contradict each other, rows held because their person is torn