generated from unai/python_boilerplate
107 lines
2.6 KiB
Python
107 lines
2.6 KiB
Python
"""Configuración compartida para los tests de pytest."""
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_channels():
|
|
"""Fixture con datos de ejemplo de canales."""
|
|
return [
|
|
{
|
|
"name": "Channel 1",
|
|
"stream_id": 101,
|
|
"stream_icon": "http://example.com/icon1.png",
|
|
"category_id": "1",
|
|
},
|
|
{
|
|
"name": "Channel 2",
|
|
"stream_id": 102,
|
|
"stream_icon": "http://example.com/icon2.png",
|
|
"category_id": "2",
|
|
},
|
|
{
|
|
"name": "Channel 3",
|
|
"stream_id": 103,
|
|
"stream_icon": "",
|
|
"category_id": "",
|
|
},
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def channels_for_filtering():
|
|
"""Fixture con canales para probar filtros de inclusión/exclusión."""
|
|
return [
|
|
{
|
|
"name": "ESPN Sports",
|
|
"stream_id": 201,
|
|
"stream_icon": "http://example.com/espn.png",
|
|
"category_id": "sports",
|
|
},
|
|
{
|
|
"name": "HBO Movies",
|
|
"stream_id": 202,
|
|
"stream_icon": "http://example.com/hbo.png",
|
|
"category_id": "movies",
|
|
},
|
|
{
|
|
"name": "CNN News",
|
|
"stream_id": 203,
|
|
"stream_icon": "http://example.com/cnn.png",
|
|
"category_id": "news",
|
|
},
|
|
{
|
|
"name": "Sports Center ESPN",
|
|
"stream_id": 204,
|
|
"stream_icon": "http://example.com/sc.png",
|
|
"category_id": "sports",
|
|
},
|
|
{
|
|
"name": "BBC World",
|
|
"stream_id": 205,
|
|
"stream_icon": "http://example.com/bbc.png",
|
|
"category_id": "news",
|
|
},
|
|
{
|
|
"name": "Adult Content",
|
|
"stream_id": 206,
|
|
"stream_icon": "http://example.com/adult.png",
|
|
"category_id": "adult",
|
|
},
|
|
{
|
|
"name": "FOX News",
|
|
"stream_id": 207,
|
|
"stream_icon": "http://example.com/fox.png",
|
|
"category_id": "news",
|
|
},
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def empty_channels():
|
|
"""Fixture con lista vacía de canales."""
|
|
return []
|
|
|
|
|
|
@pytest.fixture
|
|
def minimal_channel():
|
|
"""Fixture con canal con campos mínimos."""
|
|
return [{"stream_id": 999}]
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_settings(monkeypatch):
|
|
"""Fixture para mockear settings."""
|
|
|
|
class MockSettings:
|
|
host = "http://test-iptv.com"
|
|
username = "testuser"
|
|
password = "testpass"
|
|
port = 8080
|
|
update_interval = 60
|
|
output_file = "test_playlist.m3u"
|
|
include_text = []
|
|
exclude_text = []
|
|
|
|
return MockSettings()
|