Spaces:
Sleeping
Sleeping
feat: add tests for Crown Commend health and generate endpoints
Browse files- tests/test_commend.py +27 -0
tests/test_commend.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Tests for Crown Commend endpoints."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from fastapi.testclient import TestClient
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def test_commend_health(client: TestClient) -> None:
|
| 9 |
+
"""Commend health endpoint should return status information."""
|
| 10 |
+
response = client.get("/api/commend/health")
|
| 11 |
+
assert response.status_code == 200
|
| 12 |
+
data = response.json()
|
| 13 |
+
assert "gemini" in data
|
| 14 |
+
assert "youtube" in data
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def test_commend_generate_rejects_invalid_url(client: TestClient) -> None:
|
| 18 |
+
"""Generate endpoint should reject a non-YouTube URL."""
|
| 19 |
+
response = client.post(
|
| 20 |
+
"/api/commend/generate",
|
| 21 |
+
json={
|
| 22 |
+
"url": "https://example.com",
|
| 23 |
+
"language": "en",
|
| 24 |
+
"style": "supportive",
|
| 25 |
+
},
|
| 26 |
+
)
|
| 27 |
+
assert response.status_code in (400, 422)
|