Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Erik
f82e7116b2 Fix islamic_prayer_times test accessing external API 2023-03-23 16:10:04 +01:00
2 changed files with 12 additions and 4 deletions

View file

@ -29,7 +29,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Unload Islamic Prayer entry from config_entry."""
"""Unload Islamic Prayer config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(
config_entry, PLATFORMS
):

View file

@ -52,9 +52,17 @@ async def test_options(hass: HomeAssistant) -> None:
assert result["type"] == data_entry_flow.FlowResultType.FORM
assert result["step_id"] == "init"
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={CONF_CALC_METHOD: "makkah"}
)
with patch(
"prayer_times_calculator.PrayerTimesCalculator.fetch_prayer_times",
return_value=PRAYER_TIMES,
) as fetch_prayer_times_mock:
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={CONF_CALC_METHOD: "makkah"}
)
await hass.async_block_till_done()
# Test updating options refreshes data
fetch_prayer_times_mock.assert_called_once()
assert result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY
assert result["data"][CONF_CALC_METHOD] == "makkah"