Stabilize backend route tests

This commit is contained in:
2026-06-30 17:12:22 +08:00
parent 1d3891d949
commit 4eb9452760
3 changed files with 22 additions and 20 deletions

View File

@@ -1,9 +1,5 @@
from pathlib import Path
from fastapi.testclient import TestClient
from app.main import app
def test_project_var_artifact_path_is_served(tmp_path, monkeypatch):
from app import main
@@ -30,6 +26,7 @@ def test_project_var_artifact_path_is_served(tmp_path, monkeypatch):
)
monkeypatch.setattr(main, "settings", patched)
response = TestClient(app).get("/api/artifacts/var/uploads/datasets/case/labels/label.txt")
assert response.status_code == 200
assert response.text == "ok"
response = main.api_artifact("var/uploads/datasets/case/labels/label.txt")
assert Path(response.path) == artifact
assert response.media_type == "text/plain"