Prevent 3rd party lib from opening sockets in zeroconf tests (#56324)

This commit is contained in:
Erik Montnemery 2021-09-17 11:19:32 +02:00 committed by GitHub
parent fce7f0873e
commit bce4c5eb11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,8 +4,14 @@ from unittest.mock import AsyncMock, patch
import pytest
@pytest.fixture(autouse=True)
def zc_mock_get_source_ip(mock_get_source_ip):
"""Enable the mock_get_source_ip fixture for all zeroconf tests."""
return mock_get_source_ip
@pytest.fixture
def mock_async_zeroconf():
def mock_async_zeroconf(mock_zeroconf):
"""Mock AsyncZeroconf."""
with patch("homeassistant.components.zeroconf.HaAsyncZeroconf") as mock_aiozc:
zc = mock_aiozc.return_value