mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add Jewish Calendar reconfiguration test (#118833)
* Revert "Remove flaky tests" This reverts commit c4de9fdcbeca6075574b578e05916a08231647af. * Change reconfigure test to be based on data * Don't assert using internals * Fix assertions to be on config entry
This commit is contained in:
parent
73475aa675
commit
f40897b54c
@ -9,6 +9,7 @@ from homeassistant.components.jewish_calendar.const import (
|
|||||||
CONF_CANDLE_LIGHT_MINUTES,
|
CONF_CANDLE_LIGHT_MINUTES,
|
||||||
CONF_DIASPORA,
|
CONF_DIASPORA,
|
||||||
CONF_HAVDALAH_OFFSET_MINUTES,
|
CONF_HAVDALAH_OFFSET_MINUTES,
|
||||||
|
DEFAULT_CANDLE_LIGHT,
|
||||||
DEFAULT_DIASPORA,
|
DEFAULT_DIASPORA,
|
||||||
DEFAULT_LANGUAGE,
|
DEFAULT_LANGUAGE,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -138,3 +139,28 @@ async def test_options(hass: HomeAssistant, mock_config_entry: MockConfigEntry)
|
|||||||
assert len(entries) == 1
|
assert len(entries) == 1
|
||||||
assert entries[0].options[CONF_CANDLE_LIGHT_MINUTES] == 25
|
assert entries[0].options[CONF_CANDLE_LIGHT_MINUTES] == 25
|
||||||
assert entries[0].options[CONF_HAVDALAH_OFFSET_MINUTES] == 34
|
assert entries[0].options[CONF_HAVDALAH_OFFSET_MINUTES] == 34
|
||||||
|
|
||||||
|
|
||||||
|
async def test_options_reconfigure(
|
||||||
|
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||||
|
) -> None:
|
||||||
|
"""Test that updating the options of the Jewish Calendar integration triggers a value update."""
|
||||||
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert CONF_CANDLE_LIGHT_MINUTES not in mock_config_entry.options
|
||||||
|
|
||||||
|
# Update the CONF_CANDLE_LIGHT_MINUTES option to a new value
|
||||||
|
result = await hass.config_entries.options.async_init(mock_config_entry.entry_id)
|
||||||
|
result = await hass.config_entries.options.async_configure(
|
||||||
|
result["flow_id"],
|
||||||
|
user_input={
|
||||||
|
CONF_CANDLE_LIGHT_MINUTES: DEFAULT_CANDLE_LIGHT + 1,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert result["result"]
|
||||||
|
|
||||||
|
# The value of the "upcoming_shabbat_candle_lighting" sensor should be the new value
|
||||||
|
assert (
|
||||||
|
mock_config_entry.options[CONF_CANDLE_LIGHT_MINUTES] == DEFAULT_CANDLE_LIGHT + 1
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user