Add wemo config_flow test to get 100% coverage (#62158)

This commit is contained in:
Eric Severance 2021-12-18 21:43:31 -08:00 committed by GitHub
parent 6fd617a89e
commit 8d6763eaad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,22 @@
"""Tests for Wemo config flow."""
from homeassistant import data_entry_flow
from homeassistant.components.wemo.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.core import HomeAssistant
from tests.common import patch
async def test_not_discovered(hass: HomeAssistant) -> None:
"""Test setting up with no devices discovered."""
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_USER},
)
with patch("homeassistant.components.wemo.config_flow.pywemo") as mock_pywemo:
mock_pywemo.discover_devices.return_value = []
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "no_devices_found"