Prevent network access in emulated_hue tests (#109991)

This commit is contained in:
Erik Montnemery 2024-02-08 13:00:45 +01:00 committed by GitHub
parent 55f10656a7
commit c7957f8e94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,9 @@
"""Test the Emulated Hue component.""" """Test the Emulated Hue component."""
from datetime import timedelta from datetime import timedelta
from typing import Any from typing import Any
from unittest.mock import AsyncMock, patch from unittest.mock import AsyncMock, Mock, patch
from aiohttp import web
from homeassistant.components.emulated_hue.config import ( from homeassistant.components.emulated_hue.config import (
DATA_KEY, DATA_KEY,
@ -135,6 +137,9 @@ async def test_setup_works(hass: HomeAssistant) -> None:
AsyncMock(), AsyncMock(),
) as mock_create_upnp_datagram_endpoint, patch( ) as mock_create_upnp_datagram_endpoint, patch(
"homeassistant.components.emulated_hue.async_get_source_ip" "homeassistant.components.emulated_hue.async_get_source_ip"
), patch(
"homeassistant.components.emulated_hue.web.TCPSite",
return_value=Mock(spec_set=web.TCPSite),
): ):
mock_create_upnp_datagram_endpoint.return_value = AsyncMock( mock_create_upnp_datagram_endpoint.return_value = AsyncMock(
spec=UPNPResponderProtocol spec=UPNPResponderProtocol