- profiler: Literal instead of Query(enum=...) (broke on FastAPI 0.162) - pin fastapi/starlette/uvicorn/pydantic for the profiler, upper bounds for APP_CORE - health check: show the service log when an HTTP check fails - update.sh: the "before" version comes from deploy.state - migrate.py: hint about OVPMON_*_DB_PATH when the default database is missing - docs: --source --no-pull mode, dependency pinning, PIP_CONSTRAINT - tests: new test for the section parameter, fixed test_server_process.py Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
22 lines
805 B
Python
22 lines
805 B
Python
import os
|
|
import tempfile
|
|
|
|
# The DB path must be set before database.py is imported (via main)
|
|
_tmp = tempfile.TemporaryDirectory()
|
|
os.environ["OVPMON_PROFILER_DB_PATH"] = os.path.join(_tmp.name, "test.db")
|
|
|
|
from fastapi.testclient import TestClient
|
|
from main import app
|
|
from utils.auth import verify_token
|
|
|
|
app.dependency_overrides[verify_token] = lambda: {"sub": "test"}
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_config_section_values():
|
|
r = client.get("/api/config", params={"section": "server"})
|
|
assert r.status_code == 200 and r.json()["server"] and not r.json().get("pki")
|
|
assert client.get("/api/config", params={"section": "pki"}).status_code == 200
|
|
assert client.get("/api/config").status_code == 200
|
|
assert client.get("/api/config", params={"section": "bogus"}).status_code == 422
|