Prevent opening sockets in panasonic_viera tests (#56441)

This commit is contained in:
Erik Montnemery 2021-09-20 15:01:49 +02:00 committed by GitHub
parent a84e86ff13
commit fc4bb40a63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
"""Test the Panasonic Viera setup process.""" """Test the Panasonic Viera setup process."""
from unittest.mock import patch from unittest.mock import Mock, patch
from homeassistant.components.panasonic_viera.const import ( from homeassistant.components.panasonic_viera.const import (
ATTR_DEVICE_INFO, ATTR_DEVICE_INFO,
@ -185,14 +185,21 @@ async def test_setup_entry_unencrypted_missing_device_info_none(hass):
async def test_setup_config_flow_initiated(hass): async def test_setup_config_flow_initiated(hass):
"""Test if config flow is initiated in setup.""" """Test if config flow is initiated in setup."""
assert ( mock_remote = get_mock_remote()
await async_setup_component( mock_remote.get_device_info = Mock(side_effect=OSError)
hass,
DOMAIN, with patch(
{DOMAIN: {CONF_HOST: "0.0.0.0"}}, "homeassistant.components.panasonic_viera.config_flow.RemoteControl",
return_value=mock_remote,
):
assert (
await async_setup_component(
hass,
DOMAIN,
{DOMAIN: {CONF_HOST: "0.0.0.0"}},
)
is True
) )
is True
)
assert len(hass.config_entries.flow.async_progress()) == 1 assert len(hass.config_entries.flow.async_progress()) == 1