feat(co-gahusb): FastMCP 서버 (12 툴 + Bearer 인증 + health)

This commit is contained in:
2026-06-12 07:25:47 +09:00
parent d71937b6ee
commit e115eee159
2 changed files with 157 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# co-gahusb/tests/test_server.py
import os
os.environ["CO_BUS_KEY"] = "test-key"
from starlette.testclient import TestClient
from app.server import app
def test_health_open_without_auth():
client = TestClient(app)
res = client.get("/health")
assert res.status_code == 200
assert res.json()["status"] == "ok"
def test_mcp_requires_bearer():
client = TestClient(app)
res = client.post("/mcp", json={})
assert res.status_code == 401
def test_mcp_wrong_key_rejected():
client = TestClient(app)
res = client.post("/mcp", json={}, headers={"Authorization": "Bearer wrong"})
assert res.status_code == 401