parent
a003f89a5e
commit
e9fcef1b57
|
@ -170,6 +170,7 @@ MODELS_TV_ONLY = (
|
|||
"BEAM",
|
||||
"PLAYBAR",
|
||||
"PLAYBASE",
|
||||
"ULTRA",
|
||||
)
|
||||
MODELS_LINEIN_AND_TV = ("AMP",)
|
||||
|
||||
|
|
|
@ -580,13 +580,19 @@ def alarm_clock_fixture_extended():
|
|||
return alarm_clock
|
||||
|
||||
|
||||
@pytest.fixture(name="speaker_model")
|
||||
def speaker_model_fixture(request: pytest.FixtureRequest):
|
||||
"""Create fixture for the speaker model."""
|
||||
return getattr(request, "param", "Model Name")
|
||||
|
||||
|
||||
@pytest.fixture(name="speaker_info")
|
||||
def speaker_info_fixture():
|
||||
def speaker_info_fixture(speaker_model):
|
||||
"""Create speaker_info fixture."""
|
||||
return {
|
||||
"zone_name": "Zone A",
|
||||
"uid": "RINCON_test",
|
||||
"model_name": "Model Name",
|
||||
"model_name": speaker_model,
|
||||
"model_number": "S12",
|
||||
"hardware_version": "1.20.1.6-1.1",
|
||||
"software_version": "49.2-64250",
|
||||
|
|
|
@ -10,6 +10,7 @@ from syrupy import SnapshotAssertion
|
|||
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_INPUT_SOURCE,
|
||||
ATTR_INPUT_SOURCE_LIST,
|
||||
ATTR_MEDIA_ANNOUNCE,
|
||||
ATTR_MEDIA_CONTENT_ID,
|
||||
ATTR_MEDIA_CONTENT_TYPE,
|
||||
|
@ -1205,3 +1206,27 @@ async def test_media_get_queue(
|
|||
)
|
||||
soco_mock.get_queue.assert_called_with(max_items=0)
|
||||
assert result == snapshot
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("speaker_model", "source_list"),
|
||||
[
|
||||
("Sonos Arc Ultra", [SOURCE_TV]),
|
||||
("Sonos Arc", [SOURCE_TV]),
|
||||
("Sonos Playbar", [SOURCE_TV]),
|
||||
("Sonos Connect", [SOURCE_LINEIN]),
|
||||
("Sonos Play:5", [SOURCE_LINEIN]),
|
||||
("Sonos Amp", [SOURCE_LINEIN, SOURCE_TV]),
|
||||
("Sonos Era", None),
|
||||
],
|
||||
indirect=["speaker_model"],
|
||||
)
|
||||
async def test_media_source_list(
|
||||
hass: HomeAssistant,
|
||||
async_autosetup_sonos,
|
||||
speaker_model: str,
|
||||
source_list: list[str] | None,
|
||||
) -> None:
|
||||
"""Test the mapping between the speaker model name and source_list."""
|
||||
state = hass.states.get("media_player.zone_a")
|
||||
assert state.attributes.get(ATTR_INPUT_SOURCE_LIST) == source_list
|
||||
|
|
Loading…
Reference in New Issue