23 lines
667 B
Python
23 lines
667 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.main import app
|
|
|
|
|
|
def test_healthz():
|
|
with TestClient(app) as client:
|
|
response = client.get("/healthz")
|
|
assert response.status_code == 200
|
|
assert response.json()["status"] == "ok"
|
|
|
|
|
|
def test_index_and_assets():
|
|
with TestClient(app) as client:
|
|
page = client.get("/")
|
|
css = client.get("/static/css/app.css")
|
|
assert page.status_code == 200 and "__TITLE__" in page.text
|
|
assert css.status_code == 200 and css.headers["cache-control"] == "no-cache"
|
|
|
|
|
|
def test_info():
|
|
with TestClient(app) as client:
|
|
assert client.get("/api/info").json()["name"] == "__TITLE__"
|