mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
refactor(scheduler): 重构任务调度器并添加分布式锁支持 test: 重构测试文件结构并添加健康检查测试 style(schema): 统一将example字段改为examples chore: 清理无用的测试文件
23 lines
529 B
Python
23 lines
529 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
测试文件
|
|
|
|
注意:使用普通的 def 定义测试函数,不要使用 async def
|
|
执行命令: pytest tests/test.py
|
|
"""
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
|
|
def test_check_health(test_client: TestClient):
|
|
"""测试健康检查接口"""
|
|
response = test_client.get("/common/health")
|
|
assert response.status_code == 200
|
|
assert response.json() == {"msg": "Healthy"}
|
|
|
|
|
|
# 运行所有测试
|
|
if __name__ == "__main__":
|
|
pytest.main(["-v", "tests/test_main.py"])
|