upload project source code
This commit is contained in:
22
后端源码/yifan.action-ai.cn/api-bak/tests/test_main.py
Normal file
22
后端源码/yifan.action-ai.cn/api-bak/tests/test_main.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# -*- 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"])
|
||||
Reference in New Issue
Block a user