import datetime

import pytest

from gallery.painting.matchtv.api import MatchTvApi
from tests.data.matchtv import MATCHTV_MOCK_SOURCE


@pytest.fixture(name="matchtv_api", scope="module")
def matchtv_api_fixture() -> MatchTvApi:
    api = MatchTvApi()
    api.SOURCE = MATCHTV_MOCK_SOURCE
    return api


async def test_search(matchtv_api: MatchTvApi):
    result = await matchtv_api.find_channels("матч")
    assert len(result) == 6


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