Skip to content

Commit

Permalink
Velbus finish config-flow-test-coverage (home-assistant#133149)
Browse files Browse the repository at this point in the history
Co-authored-by: Joost Lekkerkerker <[email protected]>
  • Loading branch information
cereal2nd and joostlek authored Dec 16, 2024
1 parent 0a0f482 commit 38fdfba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 1 addition & 4 deletions homeassistant/components/velbus/quality_scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
8 changes: 7 additions & 1 deletion tests/components/velbus/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 38fdfba

Please sign in to comment.