From 9c192dea9c66cc66bfbef2b20baa28fa0d8a418f Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Thu, 8 Sep 2022 22:49:49 +0200 Subject: [PATCH] Allow OpenWeatherMap config flow to test using old API to pass (#78074) Co-authored-by: Paulus Schoutsen --- homeassistant/components/openweathermap/config_flow.py | 2 +- tests/components/openweathermap/test_config_flow.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/openweathermap/config_flow.py b/homeassistant/components/openweathermap/config_flow.py index 612965bdb2f..c418231946f 100644 --- a/homeassistant/components/openweathermap/config_flow.py +++ b/homeassistant/components/openweathermap/config_flow.py @@ -130,4 +130,4 @@ class OpenWeatherMapOptionsFlow(config_entries.OptionsFlow): async def _is_owm_api_online(hass, api_key, lat, lon): owm = OWM(api_key).weather_manager() - return await hass.async_add_executor_job(owm.one_call, lat, lon) + return await hass.async_add_executor_job(owm.weather_at_coords, lat, lon) diff --git a/tests/components/openweathermap/test_config_flow.py b/tests/components/openweathermap/test_config_flow.py index 12ee849d3d2..40931dc2ce2 100644 --- a/tests/components/openweathermap/test_config_flow.py +++ b/tests/components/openweathermap/test_config_flow.py @@ -208,6 +208,8 @@ def _create_mocked_owm(is_api_online: bool): mocked_owm.one_call.return_value = one_call - mocked_owm.weather_manager.return_value.one_call.return_value = is_api_online + mocked_owm.weather_manager.return_value.weather_at_coords.return_value = ( + is_api_online + ) return mocked_owm