SurfSense/surfsense_backend/tests/integration/podcasts/test_voices.py
CREDO23 c84525897b test(podcasts): relocate stateful tests to integration
Move the lifecycle service, Celery task bodies, and mark_failed coverage out of
DB-faking unit tests and into integration tests against a real Postgres, faking
only true externals (broker, object store, TTS, ffmpeg, billing, LLM). Add HTTP
slices for cancel, voices, scoping, and public-chat streaming. The unit tier is
now fake-free pure logic with no session doubles.
2026-06-11 06:27:00 +02:00

31 lines
897 B
Python

"""GET /podcasts/voices: the active provider's catalog, or 503 if unconfigured.
The brief UI needs the voices the configured TTS provider offers; with no
provider configured there is nothing to choose from, which is a 503 rather than
an empty list.
"""
import pytest
from app.config import config as app_config
pytestmark = pytest.mark.integration
BASE = "/api/v1/podcasts"
async def test_voices_returns_the_active_providers_catalog(client):
resp = await client.get(f"{BASE}/voices")
assert resp.status_code == 200
voices = resp.json()
assert voices # openai/tts-1 offers voices
assert {"voice_id", "display_name", "language", "gender"} <= voices[0].keys()
async def test_voices_503_when_no_tts_configured(client, monkeypatch):
monkeypatch.setattr(app_config, "TTS_SERVICE", "")
resp = await client.get(f"{BASE}/voices")
assert resp.status_code == 503