File size: 726 Bytes
6cfe55f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.testclient import TestClient
from app import create_app
@asynccontextmanager
async def noop_lifespan(app: FastAPI):
yield
def test_sys_check_available_at_root_for_frontend_probe():
app = create_app(lifespan=noop_lifespan)
client = TestClient(app)
response = client.get("/sys_check")
assert response.status_code == 200
assert response.json()["code"] == 0
def test_sys_check_still_available_under_api_prefix():
app = create_app(lifespan=noop_lifespan)
client = TestClient(app)
response = client.get("/api/sys_check")
assert response.status_code == 200
assert response.json()["code"] == 0
|