import datetime import pytest from gallery.painting.openweather.api import OpenWeatherApi from tests.common.mock import create_mock_api from tests.data.openweather import OPENWEATHER_MOCK_SOURCE @pytest.fixture(name="openweather_api", scope="module") def openweather_api_fixture() -> OpenWeatherApi: return create_mock_api(OpenWeatherApi, OPENWEATHER_MOCK_SOURCE) async def test_search(openweather_api: OpenWeatherApi): result = await openweather_api.find_locations("test") assert len(result) == 5 async def test_day(openweather_api: OpenWeatherApi): result = await openweather_api.get_day("52.968498:36.0695", datetime.date(2024, 8, 23)) assert len(result.values) == 8 async def test_days(openweather_api: OpenWeatherApi): result = await openweather_api.get_days("52.968498:36.0695", 10) assert len(result.values) == 6