Move parts of ssdp to async_upnp_client (#55540)
* Move parts of ssdp to async_upnp_client * Fix test for environments with multiple sources * Fix sonos tests * More fixes/changes * More fixes * Use async_upnp_client==0.21.0 * Pylint/test fixes * More changes after review * Fix tests * Improve testing * Fix mypy * Fix yamaha_musiccast tests? * Changes after review * Pylint * Reduce calls to combined_headers * Update to async_upnp_client==0.21.1 * Update to async_upnp_client==0.21.2 * use as_dict Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
a4a6bf8a85
commit
73260c5b88
30 changed files with 890 additions and 1558 deletions
25
tests/components/ssdp/conftest.py
Normal file
25
tests/components/ssdp/conftest.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""Configuration for SSDP tests."""
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from async_upnp_client.ssdp_listener import SsdpListener
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def silent_ssdp_listener():
|
||||
"""Patch SsdpListener class, preventing any actual SSDP traffic."""
|
||||
with patch("homeassistant.components.ssdp.SsdpListener.async_start"), patch(
|
||||
"homeassistant.components.ssdp.SsdpListener.async_stop"
|
||||
), patch("homeassistant.components.ssdp.SsdpListener.async_search"):
|
||||
# Fixtures are initialized before patches. When the component is started here,
|
||||
# certain functions/methods might not be patched in time.
|
||||
yield SsdpListener
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_flow_init(hass):
|
||||
"""Mock hass.config_entries.flow.async_init."""
|
||||
with patch.object(
|
||||
hass.config_entries.flow, "async_init", return_value=AsyncMock()
|
||||
) as mock_init:
|
||||
yield mock_init
|
Loading…
Add table
Add a link
Reference in a new issue