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
|
@ -74,16 +74,28 @@ def soco_fixture(music_library, speaker_info, battery_info, alarm_clock):
|
|||
yield mock_soco
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def silent_ssdp_scanner(hass):
|
||||
"""Start SSDP component and get Scanner, prevent actual SSDP traffic."""
|
||||
with patch(
|
||||
"homeassistant.components.ssdp.Scanner._async_start_ssdp_listeners"
|
||||
), patch("homeassistant.components.ssdp.Scanner._async_stop_ssdp_listeners"), patch(
|
||||
"homeassistant.components.ssdp.Scanner.async_scan"
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(name="discover", autouse=True)
|
||||
def discover_fixture(soco):
|
||||
"""Create a mock soco discover fixture."""
|
||||
|
||||
def do_callback(hass, callback, *args, **kwargs):
|
||||
callback(
|
||||
async def do_callback(hass, callback, *args, **kwargs):
|
||||
await callback(
|
||||
{
|
||||
ssdp.ATTR_UPNP_UDN: soco.uid,
|
||||
ssdp.ATTR_SSDP_LOCATION: f"http://{soco.ip_address}/",
|
||||
}
|
||||
},
|
||||
ssdp.SsdpChange.ALIVE,
|
||||
)
|
||||
return MagicMock()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue