Velbus finish config-flow-test-coverage (#133149)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
Maikel Punie 2024-12-16 13:56:17 +01:00 committed by GitHub
parent 0a0f482702
commit 38fdfba169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -7,10 +7,7 @@ rules:
This integration does not poll.
brands: done
common-modules: done
config-flow-test-coverage:
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-test-coverage: done
config-flow:
status: todo
comment: |

View File

@ -156,12 +156,18 @@ async def test_flow_usb(hass: HomeAssistant) -> None:
user_input={},
)
assert result
assert result["result"].unique_id == "0B1B:10CF_1234_Velleman_Velbus VMB1USB"
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(
domain=DOMAIN,
data={CONF_PORT: PORT_SERIAL},
unique_id="0B1B:10CF_1234_Velleman_Velbus VMB1USB",
)
entry.add_to_hass(hass)
result = await hass.config_entries.flow.async_init(