feat: 完成工作流调度与上传下载 API

This commit is contained in:
cat-shark
2026-08-08 21:04:21 +08:00
commit a8d11eafc6
32 changed files with 3675 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import threading
import time
import urllib.request
from uvicorn import Config, Server
from app.main import app
def test_uvicorn_serves_app_over_real_socket() -> None:
config = Config(app=app, host="127.0.0.1", port=0, log_level="error")
server = Server(config)
thread = threading.Thread(target=server.run, daemon=True)
thread.start()
try:
deadline = time.monotonic() + 10
while not server.started and time.monotonic() < deadline:
time.sleep(0.05)
assert server.started
port = server.servers[0].sockets[0].getsockname()[1]
with urllib.request.urlopen(f"http://127.0.0.1:{port}/health", timeout=5) as response:
assert response.status == 200
assert b'"wov-api"' in response.read()
finally:
server.should_exit = True
thread.join(timeout=10)