28 lines
864 B
Python
28 lines
864 B
Python
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
|