Allow OpenWeatherMap config flow to test using old API to pass (#78074)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Jan Bouwhuis 2022-09-08 22:49:49 +02:00 committed by GitHub
parent 2f8af92735
commit 9c192dea9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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)

View file

@ -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