feat(co-gahusb): FastMCP 서버 (12 툴 + Bearer 인증 + health)
This commit is contained in:
25
co-gahusb/tests/test_server.py
Normal file
25
co-gahusb/tests/test_server.py
Normal 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
|
||||
Reference in New Issue
Block a user