claude/skills/web-project-scaffold-containerized-python/templates/project/tests/test_app.py
Neil Bantoc 5201aa9bd5 Add web-frontend, web-project-audit and web-project-scaffold-containerized-python skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:26:33 -08:00

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__"