mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Remove options property from OptionFlow (#129890)
* Remove options property from OptionFlow * Update test_config_entries.py * Partial revert of "Remove deprecated property setters in option flows (#129773)" * Partial revert "Use new helper properties in crownstone options flow (#129774)" * Restore onewire init * Restore onvif * Restore roborock * Use deepcopy in onewire * Restore steam_online * Restore initial options property in OptionsFlowWithConfigEntry * re-add options property in SchemaOptionsFlowHandler * Restore test * Cleanup
This commit is contained in:
@@ -5066,31 +5066,6 @@ async def test_options_flow_with_config_entry(caplog: pytest.LogCaptureFixture)
|
||||
assert entry.options == {"sub_dict": {"1": "one"}, "sub_list": ["one"]}
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_integration_frame")
|
||||
@patch.object(frame, "_REPORTED_INTEGRATIONS", set())
|
||||
async def test_options_flow_options_not_mutated(hass: HomeAssistant) -> None:
|
||||
"""Test that OptionsFlow doesn't mutate entry options."""
|
||||
entry = MockConfigEntry(
|
||||
domain="test",
|
||||
data={"first": True},
|
||||
options={"sub_dict": {"1": "one"}, "sub_list": ["one"]},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
|
||||
options_flow = config_entries.OptionsFlow()
|
||||
options_flow.handler = entry.entry_id
|
||||
options_flow.hass = hass
|
||||
|
||||
options_flow.options["sub_dict"]["2"] = "two"
|
||||
options_flow._options["sub_list"].append("two")
|
||||
|
||||
assert options_flow._options == {
|
||||
"sub_dict": {"1": "one", "2": "two"},
|
||||
"sub_list": ["one", "two"],
|
||||
}
|
||||
assert entry.options == {"sub_dict": {"1": "one"}, "sub_list": ["one"]}
|
||||
|
||||
|
||||
async def test_initializing_flows_canceled_on_shutdown(
|
||||
hass: HomeAssistant, manager: config_entries.ConfigEntries
|
||||
) -> None:
|
||||
@@ -7466,6 +7441,7 @@ async def test_options_flow_config_entry(
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_integration_frame")
|
||||
@patch.object(frame, "_REPORTED_INTEGRATIONS", set())
|
||||
async def test_options_flow_deprecated_config_entry_setter(
|
||||
hass: HomeAssistant,
|
||||
manager: config_entries.ConfigEntries,
|
||||
@@ -7493,10 +7469,7 @@ async def test_options_flow_deprecated_config_entry_setter(
|
||||
|
||||
def __init__(self, entry) -> None:
|
||||
"""Test initialisation."""
|
||||
with patch.object(frame, "_REPORTED_INTEGRATIONS", set()):
|
||||
self.config_entry = entry
|
||||
with patch.object(frame, "_REPORTED_INTEGRATIONS", set()):
|
||||
self.options = entry.options
|
||||
self.config_entry = entry
|
||||
|
||||
async def async_step_init(self, user_input=None):
|
||||
"""Test user step."""
|
||||
@@ -7525,10 +7498,6 @@ async def test_options_flow_deprecated_config_entry_setter(
|
||||
"Detected that integration 'hue' sets option flow config_entry explicitly, "
|
||||
"which is deprecated and will stop working in 2025.12" in caplog.text
|
||||
)
|
||||
assert (
|
||||
"Detected that integration 'hue' sets option flow options explicitly, "
|
||||
"which is deprecated and will stop working in 2025.12" in caplog.text
|
||||
)
|
||||
|
||||
|
||||
async def test_add_description_placeholder_automatically(
|
||||
|
||||
Reference in New Issue
Block a user