mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-20 20:39:55 +00:00
移除RELOAD配置项,改为根据环境变量动态设置 调整banner显示逻辑,确保在日志初始化后执行 将部分错误日志改为警告级别 更新.gitignore,添加缓存目录 重构测试文件,添加健康检查测试
23 lines
456 B
Python
23 lines
456 B
Python
"""
|
|
注意测试函数是普通的 def,不是 async def。
|
|
|
|
还有client的调用也是普通的调用,不是用 await。
|
|
|
|
这让你可以直接使用 pytest 而不会遇到麻烦。
|
|
"""
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from main import create_app
|
|
|
|
app = create_app()
|
|
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_check_health():
|
|
response = client.get("/")
|
|
assert response.status_code == 200
|
|
assert response.json() == {"msg": "Healthy"}
|