crowncode-backend / tests /test_youtube.py
Rthur2003's picture
feat: add initial test files for health check and YouTube analysis endpoints
46c1e33
raw
history blame contribute delete
923 Bytes
"""Tests for YouTube analysis endpoint."""
from __future__ import annotations
from fastapi.testclient import TestClient
def test_youtube_analyze_rejects_invalid_url(client: TestClient) -> None:
"""YouTube analyze should reject a non-YouTube URL."""
response = client.post(
"/api/youtube/analyze",
json={"url": "https://example.com/not-youtube"},
)
assert response.status_code in (400, 422)
def test_youtube_analyze_rejects_empty_url(client: TestClient) -> None:
"""YouTube analyze should reject an empty URL."""
response = client.post(
"/api/youtube/analyze",
json={"url": ""},
)
assert response.status_code in (400, 422)
def test_youtube_analyze_rejects_missing_body(client: TestClient) -> None:
"""YouTube analyze should reject a request with no body."""
response = client.post("/api/youtube/analyze")
assert response.status_code == 422