2019-04-26 06:56:43 +00:00
|
|
|
"""Tests for the Sonos Media Player platform."""
|
|
|
|
from homeassistant.components.sonos import media_player, DOMAIN
|
|
|
|
from homeassistant.setup import async_setup_component
|
2016-07-29 03:40:58 +00:00
|
|
|
|
|
|
|
|
2019-04-26 06:56:43 +00:00
|
|
|
async def setup_platform(hass, config_entry, config):
|
|
|
|
"""Set up the media player platform for testing."""
|
|
|
|
config_entry.add_to_hass(hass)
|
|
|
|
assert await async_setup_component(hass, DOMAIN, config)
|
|
|
|
await hass.async_block_till_done()
|
2016-07-29 03:40:58 +00:00
|
|
|
|
|
|
|
|
2019-04-26 06:56:43 +00:00
|
|
|
async def test_async_setup_entry_hosts(hass, config_entry, config, soco):
|
|
|
|
"""Test static setup."""
|
|
|
|
await setup_platform(hass, config_entry, config)
|
2019-04-29 08:20:09 +00:00
|
|
|
|
|
|
|
entity = hass.data[media_player.DATA_SONOS].entities[0]
|
|
|
|
assert entity.soco == soco
|
2016-07-29 03:40:58 +00:00
|
|
|
|
2016-07-30 08:30:13 +00:00
|
|
|
|
2019-04-26 06:56:43 +00:00
|
|
|
async def test_async_setup_entry_discover(hass, config_entry, discover):
|
|
|
|
"""Test discovery setup."""
|
|
|
|
await setup_platform(hass, config_entry, {})
|
2019-04-29 08:20:09 +00:00
|
|
|
|
|
|
|
entity = hass.data[media_player.DATA_SONOS].entities[0]
|
|
|
|
assert entity.unique_id == 'RINCON_test'
|