mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
refactor: 优化配置和日志初始化流程
移除RELOAD配置项,改为根据环境变量动态设置 调整banner显示逻辑,确保在日志初始化后执行 将部分错误日志改为警告级别 更新.gitignore,添加缓存目录 重构测试文件,添加健康检查测试
This commit is contained in:
+20
-5
@@ -1,7 +1,22 @@
|
||||
import pytest
|
||||
"""
|
||||
注意测试函数是普通的 def,不是 async def。
|
||||
|
||||
def test_example():
|
||||
assert 1 + 1 == 2
|
||||
还有client的调用也是普通的调用,不是用 await。
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main()
|
||||
这让你可以直接使用 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"}
|
||||
|
||||
Reference in New Issue
Block a user