mirror of
https://github.com/hoshikawa2/nemo_guardrails_ci_cd.git
synced 2026-07-10 00:34:20 +00:00
first commit
This commit is contained in:
19
tests/test_api_contract.py
Normal file
19
tests/test_api_contract.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi.testclient import TestClient
|
||||
from app.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
def test_health():
|
||||
r = client.get("/health")
|
||||
assert r.status_code == 200
|
||||
assert r.json()["status"] == "ok"
|
||||
|
||||
def test_chat_allowed_contract():
|
||||
r = client.post("/chat", json={
|
||||
"messages": [{"role": "user", "content": "quero cancelar plano"}]
|
||||
})
|
||||
assert r.status_code == 200
|
||||
body = r.json()
|
||||
assert "blocked" in body
|
||||
assert "output" in body
|
||||
assert "rails" in body
|
||||
Reference in New Issue
Block a user