F1a: user fixes
Keep the TrainingSource union named in OpenAPI and serialize the selected variant directly into the flat job config. Keep the inputs GET for file-type metadata and upload availability, and remove the listing and its description. Cover both job payloads, reject site-only extraneous fields, and verify upload validation.
This commit is contained in:
@@ -10,7 +10,7 @@ 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")["sets"] == []
|
||||
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
|
||||
@@ -25,7 +25,6 @@ def test_training_inputs(tmp_path, monkeypatch):
|
||||
|
||||
expected = {"name": "cohort", "edf_files": 1, "has_ages": True, "bytes": 7}
|
||||
assert upload("cohort", [("one.EDF", b"edf"), ("edades.csv", b"ages")]) == expected
|
||||
assert training_inputs(Domain.TEA, "curve_x")["sets"] == [expected]
|
||||
|
||||
for invalid in ("bad.txt", "../x"):
|
||||
with pytest.raises(HTTPException) as rejected:
|
||||
|
||||
Reference in New Issue
Block a user