Files
streamrip-ui/backend/tests/test_podcast.py
T
loki 99cfda2b08
CI / backend-tests (push) Successful in 8s
Docker images / backend (push) Successful in 7s
Docker images / frontend (push) Successful in 22s
CI / docker (push) Successful in 3s
feat: mehr-laden paging (suche + entdecken, totals, fallback-skip)
2026-10-04 16:39:16 +02:00

38 lines
1.3 KiB
Python

from fastapi.testclient import TestClient
from app.main import app
c = TestClient(app)
def test_podcast_search_mocked(monkeypatch):
from app.services import streamrip_service as svc
async def fake_podcasts(query, limit, index=0):
assert query == "flauschig"
return [{
"source": "deezer", "media_type": "podcast", "id": "100",
"title": "Fest & Flauschig", "artist": "",
"desc": "Fest & Flauschig", "cover": None,
}], 1
monkeypatch.setattr(svc, "search_podcasts", fake_podcasts)
r = c.get("/api/search", params={"type": "podcast", "q": "flauschig"})
assert r.status_code == 200
assert r.json()["results"][0]["id"] == "100"
def test_podcast_detail_mocked(monkeypatch):
from app.api import podcast as pc
async def fake_details(show_id):
return {
"id": show_id, "title": "Fest & Flauschig", "description": "d",
"cover": None, "link": "https://www.deezer.com/show/1", "fans": 5,
"episodes": [{"id": "9", "title": "Ep 1", "duration": 600, "release_date": "2026-01-01"}],
}
monkeypatch.setattr(pc, "get_podcast_details", fake_details)
r = c.get("/api/podcast/1")
assert r.status_code == 200
assert len(r.json()["episodes"]) == 1