Move Sonos to upstream SoCo (#53351)

This commit is contained in:
Anders Melchiorsen
2021-07-23 00:40:30 +02:00
committed by GitHub
parent bfdbb93d2d
commit e85b0ec052
17 changed files with 44 additions and 44 deletions

View File

@@ -49,8 +49,8 @@ def config_entry_fixture():
@pytest.fixture(name="soco")
def soco_fixture(music_library, speaker_info, battery_info, alarm_clock):
"""Create a mock pysonos SoCo fixture."""
with patch("pysonos.SoCo", autospec=True) as mock, patch(
"""Create a mock soco SoCo fixture."""
with patch("homeassistant.components.sonos.SoCo", autospec=True) as mock, patch(
"socket.gethostbyname", return_value="192.168.42.2"
):
mock_soco = mock.return_value
@@ -76,7 +76,7 @@ def soco_fixture(music_library, speaker_info, battery_info, alarm_clock):
@pytest.fixture(name="discover", autouse=True)
def discover_fixture(soco):
"""Create a mock pysonos discover fixture."""
"""Create a mock soco discover fixture."""
def do_callback(hass, callback, *args, **kwargs):
callback(

View File

@@ -7,7 +7,7 @@ from homeassistant import config_entries, core, setup
from homeassistant.components.sonos.const import DATA_SONOS_DISCOVERY_MANAGER, DOMAIN
@patch("homeassistant.components.sonos.config_flow.pysonos.discover", return_value=True)
@patch("homeassistant.components.sonos.config_flow.soco.discover", return_value=True)
async def test_user_form(discover_mock: MagicMock, hass: core.HomeAssistant):
"""Test we get the user initiated form."""
await setup.async_setup_component(hass, "persistent_notification", {})

View File

@@ -13,7 +13,7 @@ async def test_creating_entry_sets_up_media_player(hass):
with patch(
"homeassistant.components.sonos.media_player.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup, patch("pysonos.discover", return_value=True):
) as mock_setup, patch("soco.discover", return_value=True):
result = await hass.config_entries.flow.async_init(
sonos.DOMAIN, context={"source": config_entries.SOURCE_USER}
)
@@ -33,7 +33,7 @@ async def test_configuring_sonos_creates_entry(hass):
"""Test that specifying config will create an entry."""
with patch(
"homeassistant.components.sonos.async_setup_entry", return_value=mock_coro(True)
) as mock_setup, patch("pysonos.discover", return_value=True):
) as mock_setup, patch("soco.discover", return_value=True):
await async_setup_component(
hass,
sonos.DOMAIN,
@@ -48,7 +48,7 @@ async def test_not_configuring_sonos_not_creates_entry(hass):
"""Test that no config will not create an entry."""
with patch(
"homeassistant.components.sonos.async_setup_entry", return_value=mock_coro(True)
) as mock_setup, patch("pysonos.discover", return_value=True):
) as mock_setup, patch("soco.discover", return_value=True):
await async_setup_component(hass, sonos.DOMAIN, {})
await hass.async_block_till_done()

View File

@@ -1,5 +1,5 @@
"""Tests for the Sonos battery sensor platform."""
from pysonos.exceptions import NotSupportedException
from soco.exceptions import NotSupportedException
from homeassistant.components.sonos import DOMAIN
from homeassistant.components.sonos.binary_sensor import ATTR_BATTERY_POWER_SOURCE