Remove password admin login, seed dev accounts, add regression tests
Admin flow: - Remove /admin/login (password-based) and /admin/dev-login routes entirely - admin_required now checks only the 'admin' role; redirects to auth.login - auth/dev-login with an ADMIN_EMAILS address redirects directly to /admin/ - .env.example: replace ADMIN_PASSWORD with ADMIN_EMAILS=admin@beanflows.coffee Dev seeding: - Add dev_seed.py: idempotent upsert of 4 fixed accounts (admin, free, starter, pro) so every access tier is testable after dev_run.sh - dev_run.sh: seed after migrations, show all 4 login shortcuts Regression tests (37 passing): - test_analytics.py: concurrent fetch_analytics calls return correct row counts (cursor thread-safety regression), column names are lowercase - test_roles.py TestAdminAuthFlow: password login routes return 404, admin_required redirects to auth.login, dev-login grants admin role and redirects to admin panel when email is in ADMIN_EMAILS - conftest.py: add mock_analytics fixture (fixes 7 pre-existing dashboard test errors); fix assertion text and lowercase metric param in tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,10 @@ info "Running migrations"
|
||||
uv run --package beanflows python -m beanflows.migrations.migrate
|
||||
ok "Migrations applied"
|
||||
|
||||
info "Seeding dev accounts"
|
||||
uv run --package beanflows python -m beanflows.dev_seed
|
||||
ok "Dev accounts ready"
|
||||
|
||||
info "Building CSS"
|
||||
make css-build
|
||||
ok "CSS built"
|
||||
@@ -114,10 +118,13 @@ fi
|
||||
echo ""
|
||||
echo -e "${BOLD}Starting BeanFlows dev environment${NC}"
|
||||
echo ""
|
||||
echo " app: http://localhost:5001"
|
||||
echo " user-login: http://localhost:5001/auth/dev-login?email=trader@beanflows.coffee"
|
||||
echo " admin-login: http://localhost:5001/auth/dev-login?email=admin@beanflows.coffee"
|
||||
echo " admin-panel: http://localhost:5001/admin/dev-login"
|
||||
echo " app: http://localhost:5001"
|
||||
echo ""
|
||||
echo " Login shortcuts (dev only):"
|
||||
echo " admin: http://localhost:5001/auth/dev-login?email=admin@beanflows.coffee"
|
||||
echo " free: http://localhost:5001/auth/dev-login?email=trader@beanflows.coffee"
|
||||
echo " starter: http://localhost:5001/auth/dev-login?email=starter@beanflows.coffee"
|
||||
echo " pro: http://localhost:5001/auth/dev-login?email=pro@beanflows.coffee"
|
||||
if [ -n "$TUNNEL_URL" ]; then
|
||||
echo " tunnel: $TUNNEL_URL"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user