F1h: Gobernanza without Vista previa and Subir archivos, button spacing
Remove both training-input endpoints and their endpoint-only test. Keep bundle import and clinical-validation uploads, which use their own API paths. External-folder training continues through cluster and TEA_REFERENCE_ROOT.
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
from fastapi import HTTPException, UploadFile
|
||||
|
||||
from core.domains import Domain
|
||||
from webapi.models import training_inputs, upload_training_inputs
|
||||
|
||||
|
||||
def test_training_inputs(tmp_path, monkeypatch):
|
||||
root = tmp_path / "reference"
|
||||
monkeypatch.setenv("TEA_REFERENCE_ROOT", str(root))
|
||||
assert training_inputs(Domain.TEA, "curve_x") == {"allowed": ["*.edf", "edades.csv"]}
|
||||
with pytest.raises(HTTPException) as undefined:
|
||||
training_inputs(Domain.TEA, "ados2_association")
|
||||
assert undefined.value.status_code == 404
|
||||
|
||||
def upload(name, files):
|
||||
return upload_training_inputs(
|
||||
Domain.TEA,
|
||||
"curve_x",
|
||||
name,
|
||||
[UploadFile(BytesIO(content), filename=filename) for filename, content in files],
|
||||
)
|
||||
|
||||
expected = {"name": "cohort", "edf_files": 1, "has_ages": True, "bytes": 7}
|
||||
assert upload("cohort", [("one.EDF", b"edf"), ("edades.csv", b"ages")]) == expected
|
||||
|
||||
for invalid in ("bad.txt", "../x"):
|
||||
with pytest.raises(HTTPException) as rejected:
|
||||
upload("cohort", [("two.edf", b"edf"), (invalid, b"bad")])
|
||||
assert rejected.value.status_code == 422
|
||||
with pytest.raises(HTTPException) as rejected:
|
||||
upload("bad set", [("one.edf", b"edf")])
|
||||
assert rejected.value.status_code == 422
|
||||
assert {path.name for path in (root / "cohort").iterdir()} == {"one.EDF", "edades.csv"}
|
||||
Reference in New Issue
Block a user