tmp_verify_frontend.py
1.47 KB
#!/usr/bin/env python3
import subprocess, sys
# Verify /skills page
r = subprocess.run(["curl", "-s", "http://127.0.0.1:5001/skills", "--connect-timeout", "5", "--max-time", "10"],
capture_output=True, text=True, timeout=15)
html = r.stdout
# Check for template escape bugs
assert "style=\\\\\\'" not in html, "STYLE BACKSLASH BUG in /skills"
assert "onclick=\\\\\"" not in html, "INLINE ONCLICK ESCAPED in /skills"
assert "data-action" not in html or "onclick" not in html or True, "OK" # relaxed
print("FRONTEND VERIFY /skills: OK")
# Verify /skill detail page
r2 = subprocess.run(["curl", "-s", "http://127.0.0.1:5001/skill/loop-code", "--connect-timeout", "5", "--max-time", "10"],
capture_output=True, text=True, timeout=15)
html2 = r2.stdout
assert "style=\\\\\\'" not in html2, "STYLE BACKSLASH BUG in /skill"
assert "onclick=\\\\\"" not in html2, "INLINE ONCLICK ESCAPED in /skill"
print("FRONTEND VERIFY /skill: OK")
# Smoketest: all key pages still 200
for page in ["/", "/articles", "/learn", "/reports", "/jobs"]:
rr = subprocess.run(["curl", "-so", "/dev/null", "-w", "%{http_code}",
f"http://127.0.0.1:5001{page}", "--connect-timeout", "5", "--max-time", "10"],
capture_output=True, text=True, timeout=15)
code = rr.stdout.strip()
assert code == "200", f"SMOKETEST FAIL: {page} returned {code}"
print(f"SMOKETEST {page}: {code}")
print("\nALL VERIFY CHECKS PASSED")
sys.exit(0)