39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from pathlib import Path
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.config import Settings
|
|
from app.main import create_app
|
|
|
|
|
|
def make_settings(tmp_path: Path) -> Settings:
|
|
return Settings(
|
|
host="127.0.0.1",
|
|
port=8095,
|
|
token="secret-token",
|
|
engine="pillow",
|
|
device="cpu",
|
|
max_upload_mb=20,
|
|
max_input_width=4096,
|
|
max_input_height=4096,
|
|
max_output_width=8192,
|
|
max_output_height=8192,
|
|
tmp_dir=str(tmp_path / "tmp"),
|
|
output_dir=str(tmp_path / "output"),
|
|
result_ttl_minutes=60,
|
|
model_dir=str(tmp_path / "models"),
|
|
default_model="realesrgan-x4plus",
|
|
)
|
|
|
|
|
|
def test_health_returns_ok(tmp_path: Path) -> None:
|
|
client = TestClient(create_app(make_settings(tmp_path)))
|
|
|
|
response = client.get("/health")
|
|
|
|
assert response.status_code == 200
|
|
payload = response.json()
|
|
assert payload["status"] == "ok"
|
|
assert payload["service"] == "skinbase-enhance-worker"
|
|
assert payload["engine"] == "pillow"
|
|
assert payload["models_loaded"] is True |