mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-08-09 03:06:05 +02:00
feat(add health endpoint):
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
from fastapi import APIRouter, File, Header, HTTPException, UploadFile
|
from fastapi import APIRouter, File, Header, HTTPException, UploadFile
|
||||||
|
from fastapi.responses import JSONResponse
|
||||||
|
|
||||||
from ..models.schemas import FileProbeResponse, Probe
|
from ..models.schemas import FileProbeResponse, Probe
|
||||||
from ..probe_actor.refusal import REFUSAL_MARKS
|
from ..probe_actor.refusal import REFUSAL_MARKS
|
||||||
@@ -70,3 +71,9 @@ async def self_probe_image():
|
|||||||
@router.get("/v1/data-config")
|
@router.get("/v1/data-config")
|
||||||
async def data_config():
|
async def data_config():
|
||||||
return [m for m in REGISTRY]
|
return [m for m in REGISTRY]
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/health")
|
||||||
|
async def health_check():
|
||||||
|
"""Health check endpoint."""
|
||||||
|
return JSONResponse(content={"status": "ok"})
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
from ..app import app
|
||||||
|
|
||||||
|
|
||||||
|
def test_health_check():
|
||||||
|
"""Test the health check endpoint."""
|
||||||
|
client = TestClient(app)
|
||||||
|
|
||||||
|
response = client.get("/health")
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json() == {"status": "ok"}
|
||||||
Reference in New Issue
Block a user