feat(yandextv): add yandextv schedule api
This commit is contained in:
@@ -4,6 +4,7 @@ import pytest
|
||||
|
||||
from gallery.painting.matchtv.api import MatchTvApi
|
||||
from gallery.painting.matchtv.mock import MATCHTV_MOCK_DATA
|
||||
from gallery.sketch.schedule.model import ChannelId
|
||||
|
||||
|
||||
@pytest.fixture(name="matchtv_api", scope="module")
|
||||
@@ -18,6 +19,8 @@ def matchtv_api_fixture() -> MatchTvApi:
|
||||
|
||||
|
||||
async def test_channel(matchtv_api: MatchTvApi):
|
||||
result = await matchtv_api.get_channel_schedule("test", datetime.date.today())
|
||||
result = await matchtv_api.get_channel_schedule(
|
||||
ChannelId.TEST, datetime.date.today()
|
||||
)
|
||||
assert result is not None
|
||||
assert len(result.values) > 0
|
||||
|
||||
26
tests/test_yandextv_api.py
Normal file
26
tests/test_yandextv_api.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from gallery.painting.yandextv.api import YandexTvApi
|
||||
from gallery.painting.yandextv.mock import YANDEXTV_MOCK_DATA
|
||||
from gallery.sketch.schedule.model import ChannelId
|
||||
|
||||
|
||||
@pytest.fixture(name="yandextv_api", scope="module")
|
||||
def yandextv_api_fixture() -> YandexTvApi:
|
||||
class MockSource:
|
||||
async def request(self, endpoint: str):
|
||||
return YANDEXTV_MOCK_DATA.get_html(endpoint.split("/")[1].split("?")[0])
|
||||
|
||||
api = YandexTvApi()
|
||||
api.SOURCE = MockSource()
|
||||
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
|
||||
Reference in New Issue
Block a user