import datetime

import pytest

from gallery.painting.yandextv.api import YandexTvApi
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
    return api


async def test_search(yandextv_api: YandexTvApi):
    result = await yandextv_api.find_channels("матч")
    assert len(result) == 4


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