Prevent 3rd party lib from opening sockets in broadlink tests (#55636)
parent
0c2772e0be
commit
4684ea2d14
|
@ -0,0 +1,11 @@
|
|||
"""Broadlink test helpers."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_heartbeat():
|
||||
"""Mock broadlink heartbeat."""
|
||||
with patch("homeassistant.components.broadlink.heartbeat.blk.ping"):
|
||||
yield
|
|
@ -2,7 +2,6 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
import broadlink.exceptions as blke
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.broadlink.const import DOMAIN
|
||||
from homeassistant.components.broadlink.device import get_domains
|
||||
|
@ -16,13 +15,6 @@ from tests.common import mock_device_registry, mock_registry
|
|||
DEVICE_FACTORY = "homeassistant.components.broadlink.device.blk.gendevice"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_heartbeat():
|
||||
"""Mock broadlink heartbeat."""
|
||||
with patch("homeassistant.components.broadlink.heartbeat.blk.ping"):
|
||||
yield
|
||||
|
||||
|
||||
async def test_device_setup(hass):
|
||||
"""Test a successful setup."""
|
||||
device = get_device("Office")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
"""Tests for Broadlink heartbeats."""
|
||||
from unittest.mock import call, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.broadlink.heartbeat import BroadlinkHeartbeat
|
||||
from homeassistant.util import dt
|
||||
|
||||
|
@ -13,13 +11,6 @@ from tests.common import async_fire_time_changed
|
|||
DEVICE_PING = "homeassistant.components.broadlink.heartbeat.blk.ping"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_heartbeat():
|
||||
"""Mock broadlink heartbeat."""
|
||||
with patch("homeassistant.components.broadlink.heartbeat.blk.ping"):
|
||||
yield
|
||||
|
||||
|
||||
async def test_heartbeat_trigger_startup(hass):
|
||||
"""Test that the heartbeat is initialized with the first config entry."""
|
||||
device = get_device("Office")
|
||||
|
|
Loading…
Reference in New Issue