ii-assistent/hunter/buildcheck.py

17 lines
582 B
Python

"""Compile all templates and exercise application creation without network access."""
import tempfile
from pathlib import Path
from . import create_app
with tempfile.TemporaryDirectory() as temporary:
app = create_app(
{"DATABASE": str(Path(temporary) / "build.sqlite3"), "SECRET_KEY": "build-only-ephemeral"}
)
with app.app_context():
for template in app.jinja_env.list_templates():
app.jinja_env.get_template(template)
assert app.test_client().get("/healthz").status_code == 200
print("Application and templates built successfully")