Sales Trainer v0.1: corporate sales-training simulator (Flask+Vue, 15 personas, chat simulator, judge, analytics)
- Auth/roles (no self-reg), admin user provision, JWT - Analyze: sales kit + initial pain-fit from form/upload - Persona generator: 15 personas (5/tier) w/ pain variety, negotiation, init mode, channel, latent/revealable, wrong_text special - Chat simulator: per-mode initiation, one-shot, hidden signals, judge-LLM debrief+coaching - Trainee loop: win/lose board, weak-areas, user-generated personas - Admin analytics; EN+TH Vue SPA served by Flask - Deploy: Dockerfile, docker-compose, README, eng-log + HANDOFF - Tests (mock LLM): m0/m1/routes/e2e all pass
This commit is contained in:
51
backend/scripts/test_routes.py
Normal file
51
backend/scripts/test_routes.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""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"
|
||||
|
||||
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/admin/users", "/api/admin/users/<email>",
|
||||
"/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()
|
||||
Reference in New Issue
Block a user