mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Velbus finish config-flow-test-coverage (#133149)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
0a0f482702
commit
38fdfba169
@ -7,10 +7,7 @@ rules:
|
|||||||
This integration does not poll.
|
This integration does not poll.
|
||||||
brands: done
|
brands: done
|
||||||
common-modules: done
|
common-modules: done
|
||||||
config-flow-test-coverage:
|
config-flow-test-coverage: done
|
||||||
status: todo
|
|
||||||
comment: |
|
|
||||||
Split test_flow_usb from the test that tests already_configured, test_flow_usb should also assert the unique_id of the entry
|
|
||||||
config-flow:
|
config-flow:
|
||||||
status: todo
|
status: todo
|
||||||
comment: |
|
comment: |
|
||||||
|
@ -156,12 +156,18 @@ async def test_flow_usb(hass: HomeAssistant) -> None:
|
|||||||
user_input={},
|
user_input={},
|
||||||
)
|
)
|
||||||
assert result
|
assert result
|
||||||
|
assert result["result"].unique_id == "0B1B:10CF_1234_Velleman_Velbus VMB1USB"
|
||||||
assert result.get("type") is FlowResultType.CREATE_ENTRY
|
assert result.get("type") is FlowResultType.CREATE_ENTRY
|
||||||
|
|
||||||
# test an already configured discovery
|
|
||||||
|
@pytest.mark.usefixtures("controller")
|
||||||
|
@patch("serial.tools.list_ports.comports", MagicMock(return_value=[com_port()]))
|
||||||
|
async def test_flow_usb_if_already_setup(hass: HomeAssistant) -> None:
|
||||||
|
"""Test we abort if Velbus USB discovbery aborts in case it is already setup."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data={CONF_PORT: PORT_SERIAL},
|
data={CONF_PORT: PORT_SERIAL},
|
||||||
|
unique_id="0B1B:10CF_1234_Velleman_Velbus VMB1USB",
|
||||||
)
|
)
|
||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user