Via-Demo / tests /test_smoke.py
Itsjustamit's picture
Upload 40 files
b998556 verified
Raw
History Blame Contribute Delete
708 Bytes
from fastapi.testclient import TestClient
from app.main import app
def test_health() -> None:
client = TestClient(app)
response = client.get("/health")
assert response.status_code == 200
assert response.json()["status"] == "ok"
def test_webhook_text_message() -> None:
client = TestClient(app)
payload = {
"message": {"chat": {"id": 101}, "text": "show settlement summary"},
}
response = client.post(
"/telegram/webhook",
json=payload,
headers={"X-Telegram-Bot-Api-Secret-Token": "local-secret"},
)
assert response.status_code == 200
data = response.json()
assert data["ok"] is True
assert data["input_type"] == "text"