import pytest from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_health_check(): """Test health endpoint""" response = client.get("/health") assert response.status_code == 200 assert response.json() == {"status": "ok"} def test_get_voices(): """Test voices endpoint""" response = client.get("/api/voices") assert response.status_code == 200 voices = response.json() assert isinstance(voices, list) assert "af_heart" in voices assert "am_adam" in voices def test_get_music_tags(): """Test music tags endpoint""" response = client.get("/api/music-tags") assert response.status_code == 200 tags = response.json() assert isinstance(tags, list) def test_list_videos(): """Test list videos endpoint""" response = client.get("/api/short-videos") assert response.status_code == 200 data = response.json() assert "videos" in data assert isinstance(data["videos"], list) def test_create_video_invalid_data(): """Test create video with invalid data""" response = client.post("/api/short-video", json={}) assert response.status_code == 422 # Validation error # Note: Full integration tests require valid PEXELS_API_KEY and HF_TTS # Run those separately with proper environment configuration