import datetime

import pytest

from gallery.painting.yandextv.api import CHANNELS_MAP, YandexTvApi
from gallery.sketch.schedule.model import ChannelId
from tests.data.yandextv import YANDEXTV_MOCK_SOURCE


@pytest.fixture(name="yandextv_api", scope="module")
def yandextv_api_fixture() -> YandexTvApi:
    api = YandexTvApi()
    api.SOURCE = YANDEXTV_MOCK_SOURCE
    CHANNELS_MAP[ChannelId("test")] = "test"
    return api


async def test_channel(yandextv_api: YandexTvApi):
    result = await yandextv_api.get_channel_schedule(
        ChannelId.TEST, datetime.date.today()
    )
    assert result is not None
    assert len(result.values) > 0
