mirror of
https://github.com/home-assistant/core.git
synced 2026-12-05 21:29:58 -04:00
Add missing test for 100% config flow coverage in silvercrest_infrared (#189498)
This commit is contained in:
@@ -103,3 +103,30 @@ async def test_user_flow_no_emitters_receivers(hass: HomeAssistant) -> None:
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "no_infrared_entities"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_infrared_emitter_entity", "mock_setup_entry")
|
||||
async def test_user_flow_requires_emitter(
|
||||
hass: HomeAssistant,
|
||||
) -> None:
|
||||
"""Test user flow requires an infrared emitter or receiver."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": SOURCE_USER}
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_DEVICE_TYPE: SilverCrestIrDeviceType.STVD45A1},
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "missing_infrared_entity"}
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_DEVICE_TYPE: SilverCrestIrDeviceType.STVD45A1,
|
||||
CONF_INFRARED_ENTITY_ID: EMITTER_ENTITY_ID,
|
||||
},
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
|
||||
Reference in New Issue
Block a user