mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
parent
ed4a23d104
commit
1ef07544d5
@ -124,7 +124,7 @@ class WizConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
data={CONF_HOST: device.ip_address},
|
||||
)
|
||||
|
||||
current_unique_ids = self._async_current_ids()
|
||||
current_unique_ids = self._async_current_ids(include_ignore=False)
|
||||
current_hosts = {
|
||||
entry.data[CONF_HOST]
|
||||
for entry in self._async_current_entries(include_ignore=False)
|
||||
|
@ -572,3 +572,46 @@ async def test_discovered_during_onboarding(hass: HomeAssistant, source, data) -
|
||||
}
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_flow_replace_ignored_device(hass: HomeAssistant) -> None:
|
||||
"""Test we can replace an ignored device via discovery."""
|
||||
# Add ignored entry to simulate previously ignored device
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
unique_id=FAKE_MAC,
|
||||
source=config_entries.SOURCE_IGNORE,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
# Patch discovery to find the same ignored device
|
||||
with _patch_discovery(), _patch_wizlight():
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "pick_device"
|
||||
# Proceed with selecting the device — previously ignored
|
||||
with (
|
||||
_patch_wizlight(),
|
||||
patch(
|
||||
"homeassistant.components.wiz.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry,
|
||||
patch(
|
||||
"homeassistant.components.wiz.async_setup",
|
||||
return_value=True,
|
||||
) as mock_setup,
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={CONF_DEVICE: FAKE_MAC}
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "WiZ Dimmable White ABCABC"
|
||||
assert result["data"] == {
|
||||
CONF_HOST: "1.1.1.1",
|
||||
}
|
||||
assert len(mock_setup.mock_calls) == 1
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user