23 lines
559 B
Python
23 lines
559 B
Python
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}
|