Files
012-kaopeilian/backend/tests/test_main.py
111 998211c483 feat: 初始化考培练系统项目
- 从服务器拉取完整代码
- 按框架规范整理项目结构
- 配置 Drone CI 测试环境部署
- 包含后端(FastAPI)、前端(Vue3)、管理端

技术栈: Vue3 + TypeScript + FastAPI + MySQL
2026-01-24 19:33:28 +08:00

36 lines
846 B
Python

"""
主应用测试
"""
import pytest
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_root():
"""测试根路径"""
response = client.get("/")
assert response.status_code == 200
data = response.json()
assert data["name"] == "考培练系统"
assert data["status"] == "running"
assert "version" in data
assert "timestamp" in data
def test_health():
"""测试健康检查端点"""
response = client.get("/health")
assert response.status_code == 200
assert response.json() == {"status": "healthy"}
def test_api_health():
"""测试API健康检查"""
response = client.get("/api/v1/health")
assert response.status_code == 200
data = response.json()
assert data["status"] == "healthy"
assert data["api_version"] == "v1"