Fix islamic_prayer_times test accessing external API
This commit is contained in:
parent
6739542a5d
commit
f82e7116b2
2 changed files with 12 additions and 4 deletions
|
@ -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
|
||||
):
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue