feat(api): /VERSION single source read at startup + GET /version

This commit is contained in:
2026-07-11 10:31:54 -05:00
parent 8e4c0bf957
commit 56278a4831
4 changed files with 63 additions and 1 deletions

22
api/tests/test_version.py Normal file
View File

@@ -0,0 +1,22 @@
from pathlib import Path
from fastapi.testclient import TestClient
from app.main import app
from app.version import VERSION, get_version
client = TestClient(app)
ROOT_VERSION = Path(__file__).resolve().parents[2] / "VERSION"
def test_get_version_matches_file():
assert ROOT_VERSION.is_file()
assert get_version() == ROOT_VERSION.read_text(encoding="utf-8").strip()
def test_app_version_matches():
assert app.version == VERSION == get_version()
def test_version_endpoint():
assert client.get("/version").json() == {"version": VERSION}