feat(weather): add weather location search
This commit is contained in:
@@ -3,20 +3,21 @@ import datetime
|
||||
import pytest
|
||||
|
||||
from gallery.painting.gismeteo.api import GismeteoApi
|
||||
from gallery.painting.gismeteo.mock import GISMETEO_MOCK_DATA
|
||||
from tests.data.gismeteo import GISMETEO_MOCK_SOURCE
|
||||
|
||||
|
||||
@pytest.fixture(name="gismeteo_api", scope="module")
|
||||
def gismeteo_api_fixture() -> GismeteoApi:
|
||||
class MockSource:
|
||||
async def request(self, endpoint: str):
|
||||
return GISMETEO_MOCK_DATA.get_html(endpoint.split("/")[-1])
|
||||
|
||||
api = GismeteoApi()
|
||||
api.SOURCE = MockSource()
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user