24 lines
660 B
Python
24 lines
660 B
Python
import datetime
|
|
|
|
import pytest
|
|
|
|
from gallery.painting.matchtv.api import MatchTvApi
|
|
from gallery.painting.matchtv.mock import MATCHTV_MOCK_DATA
|
|
|
|
|
|
@pytest.fixture(name="matchtv_api", scope="module")
|
|
def matchtv_api_fixture() -> MatchTvApi:
|
|
class MockSource:
|
|
async def request(self, endpoint: str):
|
|
return MATCHTV_MOCK_DATA.get_html(endpoint.split("/")[1].split("?")[0])
|
|
|
|
api = MatchTvApi()
|
|
api.SOURCE = MockSource()
|
|
return api
|
|
|
|
|
|
async def test_channel(matchtv_api: MatchTvApi):
|
|
result = await matchtv_api.get_channel_schedule("test", datetime.date.today())
|
|
assert result is not None
|
|
assert len(result.values) > 0
|