test(yandexweather): add yandexweather tests
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from tests.common.mock import MockSource
|
||||||
|
|
||||||
|
YANDEXWEATHER_MOCK_SOURCE = MockSource(
|
||||||
|
Path(__file__).parent,
|
||||||
|
{
|
||||||
|
"details": "details.html",
|
||||||
|
"suggest": "suggest.json",
|
||||||
|
},
|
||||||
|
)
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,27 @@
|
|||||||
|
import datetime
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from gallery.painting.yandexweather.api import YandexWeatherApi
|
||||||
|
from tests.common.mock import create_mock_api
|
||||||
|
from tests.data.yandexweather import YANDEXWEATHER_MOCK_SOURCE
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="yandexweather_api", scope="module")
|
||||||
|
def yandexweather_api_fixture() -> YandexWeatherApi:
|
||||||
|
return create_mock_api(YandexWeatherApi, YANDEXWEATHER_MOCK_SOURCE)
|
||||||
|
|
||||||
|
|
||||||
|
async def test_search(yandexweather_api: YandexWeatherApi):
|
||||||
|
result = await yandexweather_api.find_locations("test")
|
||||||
|
assert len(result) == 5
|
||||||
|
|
||||||
|
|
||||||
|
async def test_day(yandexweather_api: YandexWeatherApi):
|
||||||
|
result = await yandexweather_api.get_day("test", datetime.date.today())
|
||||||
|
assert len(result.values) == 4
|
||||||
|
|
||||||
|
|
||||||
|
async def test_days(yandexweather_api: YandexWeatherApi):
|
||||||
|
result = await yandexweather_api.get_days("test", 10)
|
||||||
|
assert len(result.values) == 10
|
||||||
Reference in New Issue
Block a user