ducklm/tests/smoke/test_api_health.py

26 lines
742 B
Python

from fastapi.testclient import TestClient
from duck_core.api import create_app
def test_health_and_status_endpoints(tmp_path, monkeypatch):
monkeypatch.setenv("DUCK_DB_PATH", str(tmp_path / "duck.sqlite3"))
app = create_app()
client = TestClient(app)
assert client.get("/health").json()["status"] == "ok"
status = client.get("/v1/status").json()
assert status["name"] == "DuckLM"
assert status["api_host"] == "127.0.0.1"
def test_webchat_index_renders(tmp_path, monkeypatch):
monkeypatch.setenv("DUCK_DB_PATH", str(tmp_path / "duck.sqlite3"))
app = create_app()
client = TestClient(app)
response = client.get("/")
assert response.status_code == 200
assert "DuckLM" in response.text