File size: 923 Bytes
46c1e33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""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