Make new tests async

This commit is contained in:
Jules 2024-06-01 18:46:03 +02:00
parent f651968b4d
commit d354199ace
Signed by: jdejaegh
GPG key ID: 99D6D184CA66933A
2 changed files with 5 additions and 5 deletions

View file

@ -22,7 +22,7 @@ def get_api_data(fixture: str) -> dict:
return json.loads(load_fixture(fixture)) return json.loads(load_fixture(fixture))
async def patched(url: str, params: dict | None = None) -> bytes: async def patched(url: str, _params: dict | None = None) -> bytes:
if "cdn.knmi.nl" in url: if "cdn.knmi.nl" in url:
file_name = "tests/fixtures/clouds_nl.png" file_name = "tests/fixtures/clouds_nl.png"
elif "app.meteo.be/services/appv4/?s=getIncaImage" in url: elif "app.meteo.be/services/appv4/?s=getIncaImage" in url:

View file

@ -142,9 +142,9 @@ async def test_hourly_forecast() -> None:
@freeze_time(datetime.fromisoformat('2024-05-31T01:50:00+02:00')) @freeze_time(datetime.fromisoformat('2024-05-31T01:50:00+02:00'))
def test_hourly_forecast_bis() -> None: async def test_hourly_forecast_bis() -> None:
api_data = get_api_data("no-midnight-bug-31-05-2024T01-55.json").get('for', {}).get('hourly') api_data = get_api_data("no-midnight-bug-31-05-2024T01-55.json").get('for', {}).get('hourly')
result = IrmKmiCoordinator.hourly_list_to_forecast(api_data) result = await IrmKmiCoordinator.hourly_list_to_forecast(api_data)
assert isinstance(result, list) assert isinstance(result, list)
@ -158,10 +158,10 @@ def test_hourly_forecast_bis() -> None:
@freeze_time(datetime.fromisoformat('2024-05-31T00:10:00+02:00')) @freeze_time(datetime.fromisoformat('2024-05-31T00:10:00+02:00'))
def test_hourly_forecast_midnight_bug() -> None: async def test_hourly_forecast_midnight_bug() -> None:
# Related to https://github.com/jdejaegh/irm-kmi-ha/issues/38 # Related to https://github.com/jdejaegh/irm-kmi-ha/issues/38
api_data = get_api_data("midnight-bug-31-05-2024T00-13.json").get('for', {}).get('hourly') api_data = get_api_data("midnight-bug-31-05-2024T00-13.json").get('for', {}).get('hourly')
result = IrmKmiCoordinator.hourly_list_to_forecast(api_data) result = await IrmKmiCoordinator.hourly_list_to_forecast(api_data)
assert isinstance(result, list) assert isinstance(result, list)