import sys
sys.path.insert(0, '.')

from core.security import get_current_user
from app.database import SessionLocal
from app.models import User

print("Testing get_current_user...")
db = SessionLocal()
try:
    # 检查数据库中是否有 admin 用户
    user = db.query(User).filter(User.username == 'admin').first()
    if user:
        print(f"Found admin user: id={user.id}, role={user.role}")
    else:
        print("Admin user not found")
finally:
    db.close()
print("OK")
