Files
Restreamer/tests/test_http_server.py
T

20 lines
748 B
Python

from pydantic import HttpUrl
from restreamer.config import ChannelConfig
from restreamer.http_server import build_playlist
def test_build_playlist_lists_all_channels() -> None:
channels = [
ChannelConfig(id="news", name="News Live", url=HttpUrl("https://www.youtube.com/watch?v=abc123")),
ChannelConfig(id="music", name="Music Live", url=HttpUrl("https://www.youtube.com/watch?v=def456")),
]
playlist = build_playlist(channels, "http://localhost:8000/")
assert playlist.startswith("#EXTM3U\n")
assert 'tvg-id="news"' in playlist
assert "http://localhost:8000/stream/news" in playlist
assert "http://localhost:8000/stream/music" in playlist
assert "http://localhost:8000//stream" not in playlist