54 lines
1.9 KiB
Python
54 lines
1.9 KiB
Python
"""Verify full backend imports + all routes registered (no LLM needed)."""
|
|
import os
|
|
import sys
|
|
import tempfile
|
|
import warnings
|
|
from pathlib import Path
|
|
|
|
warnings.filterwarnings("ignore", message="The HMAC key is")
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
|
|
|
|
tempdir = tempfile.mkdtemp(prefix="st_import_")
|
|
os.environ["DATA_DIR"] = tempdir
|
|
os.environ["JWT_SECRET"] = "test-secret-key-0123456789abcdef"
|
|
os.environ["APP_ENV"] = "test"
|
|
os.environ["BOOTSTRAP_ADMIN_PASSWORD"] = "test-bootstrap-password"
|
|
|
|
from app.factory import create_app # noqa: E402
|
|
from app.config import Config # noqa: E402
|
|
|
|
Config.DATA_DIR = Path(tempdir)
|
|
Config.LLM_API_KEY = ""
|
|
Config.LLM_BASE_URL = ""
|
|
|
|
|
|
def main():
|
|
app = create_app()
|
|
rules = sorted({str(rule) for rule in app.url_map.iter_rules() if str(rule).startswith("/api")})
|
|
expected = [
|
|
"/api/auth/login", "/api/auth/me", "/api/auth/setup",
|
|
"/api/admin/users", "/api/admin/users/<username>",
|
|
"/api/groups", "/api/groups/<gid>",
|
|
"/api/groups/<gid>/analyze", "/api/groups/<gid>/personas",
|
|
"/api/groups/<gid>/personas/<pid>", "/api/groups/<gid>/personas/<pid>",
|
|
"/api/groups/<gid>/reanalyze",
|
|
"/api/chat/<gid>/personas/<pid>/chat/start",
|
|
"/api/chat/<gid>/personas/<pid>/chat/send",
|
|
"/api/chat/<gid>/personas/<pid>/chat/finish",
|
|
"/api/chat/sessions", "/api/chat/sessions/<sid>",
|
|
"/api/me/board", "/api/me/weak-areas", "/api/me/personas",
|
|
"/api/me/personas/generate",
|
|
"/api/analytics",
|
|
]
|
|
missing = [e for e in expected if e not in rules]
|
|
if missing:
|
|
raise SystemExit(f"MISSING ROUTES: {missing}")
|
|
print(f"[ok] all {len(expected)} expected routes registered")
|
|
for r in sorted(rules):
|
|
print(" ", r)
|
|
print("ALL ROUTE REGISTRATION TESTS PASSED")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|