import datetime

import pytest

from gallery.painting.gismeteo.api import GismeteoApi
from tests.data.gismeteo import GISMETEO_MOCK_SOURCE


@pytest.fixture(name="gismeteo_api", scope="module")
def gismeteo_api_fixture() -> GismeteoApi:
    api = GismeteoApi()
    api.SOURCE = GISMETEO_MOCK_SOURCE
    return api


async def test_search(gismeteo_api: GismeteoApi):
    result = await gismeteo_api.find_locations("test")
    assert len(result) == 10


async def test_day(gismeteo_api: GismeteoApi):
    result = await gismeteo_api.get_day("test", datetime.date.today())
    assert len(result.values) == 8


async def test_days(gismeteo_api: GismeteoApi):
    result = await gismeteo_api.get_days("test", 10)
    assert len(result.values) == 10
