#!/usr/bin/env python3
"""
最简单的测试
"""
import requests
import json

def test_api():
    """测试API"""
    try:
        # 测试健康检查
        health_response = requests.get("http://localhost:8000/health")
        print(f"健康检查: {health_response.status_code} - {health_response.text}")
        
        # 测试登录
        login_data = {
            "username": "testuser",
            "password": "TestPass123!"
        }
        
        login_response = requests.post(
            "http://localhost:8000/api/v1/auth/login",
            json=login_data,
            headers={"Content-Type": "application/json"}
        )
        
        print(f"登录请求: {login_response.status_code}")
        print(f"响应头: {dict(login_response.headers)}")
        print(f"响应内容: {login_response.text}")
        
        if login_response.status_code == 500:
            print("❌ 服务器内部错误")
        elif login_response.status_code == 200:
            print("✅ 登录成功")
        else:
            print(f"⚠️ 其他状态码: {login_response.status_code}")
            
    except Exception as e:
        print(f"❌ 测试失败: {e}")

if __name__ == "__main__":
    test_api()
