17 lines
361 B
Python
17 lines
361 B
Python
"""Health 接口测试。"""
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.main import app
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_health():
|
|
r = client.get("/api/health")
|
|
assert r.status_code == 200
|
|
data = r.json()
|
|
assert data.get("code") == 0
|
|
assert data.get("data", {}).get("status") == "up"
|
|
assert "trace_id" in data
|