mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Prevent 3rd party lib from opening sockets in rfxtrx tests (#56331)
This commit is contained in:
parent
55a77b2ba2
commit
797b68b42d
@ -1,4 +1,4 @@
|
|||||||
"""Test the Tado config flow."""
|
"""Test the Rfxtrx config flow."""
|
||||||
import os
|
import os
|
||||||
from unittest.mock import MagicMock, patch, sentinel
|
from unittest.mock import MagicMock, patch, sentinel
|
||||||
|
|
||||||
@ -32,11 +32,8 @@ def com_port():
|
|||||||
return port
|
return port
|
||||||
|
|
||||||
|
|
||||||
@patch(
|
@patch("homeassistant.components.rfxtrx.rfxtrxmod.PyNetworkTransport", autospec=True)
|
||||||
"homeassistant.components.rfxtrx.rfxtrxmod.PyNetworkTransport.connect",
|
async def test_setup_network(transport_mock, hass):
|
||||||
return_value=None,
|
|
||||||
)
|
|
||||||
async def test_setup_network(connect_mock, hass):
|
|
||||||
"""Test we can setup network."""
|
"""Test we can setup network."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
@ -170,10 +167,11 @@ async def test_setup_serial_manual(com_mock, connect_mock, hass):
|
|||||||
|
|
||||||
|
|
||||||
@patch(
|
@patch(
|
||||||
"homeassistant.components.rfxtrx.rfxtrxmod.PyNetworkTransport.connect",
|
"homeassistant.components.rfxtrx.rfxtrxmod.PyNetworkTransport",
|
||||||
|
autospec=True,
|
||||||
side_effect=OSError,
|
side_effect=OSError,
|
||||||
)
|
)
|
||||||
async def test_setup_network_fail(connect_mock, hass):
|
async def test_setup_network_fail(transport_mock, hass):
|
||||||
"""Test we can setup network."""
|
"""Test we can setup network."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user