Add media dirs core configuration (#40071)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
1 parent
ce86112612
commit
5d518b5365
9 files changed
+157
-40
No files matched your search
@@ -5,6 +5,7 @@ from homeassistant.components import media_source
|
||||
from homeassistant.components.media_player.const import MEDIA_CLASS_DIRECTORY
|
||||
from homeassistant.components.media_player.errors import BrowseError
|
||||
from homeassistant.components.media_source import const
|
||||
from homeassistant.components.media_source.error import Unresolvable
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.async_mock import patch
|
||||
@@ -62,11 +63,23 @@ async def test_async_resolve_media(hass):
|
||||
assert await async_setup_component(hass, const.DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Test no media content
|
||||
media = await media_source.async_resolve_media(hass, "")
|
||||
media = await media_source.async_resolve_media(
|
||||
hass,
|
||||
media_source.generate_media_source_id(const.DOMAIN, "media/test.mp3"),
|
||||
)
|
||||
assert isinstance(media, media_source.models.PlayMedia)
|
||||
|
||||
|
||||
async def test_async_unresolve_media(hass):
|
||||
"""Test browse media."""
|
||||
assert await async_setup_component(hass, const.DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Test no media content
|
||||
with pytest.raises(Unresolvable):
|
||||
await media_source.async_resolve_media(hass, "")
|
||||
|
||||
|
||||
async def test_websocket_browse_media(hass, hass_ws_client):
|
||||
"""Test browse media websocket."""
|
||||
assert await async_setup_component(hass, const.DOMAIN, {})
|
||||
@@ -127,7 +140,7 @@ async def test_websocket_resolve_media(hass, hass_ws_client):
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
media = media_source.models.PlayMedia("/media/test.mp3", "audio/mpeg")
|
||||
media = media_source.models.PlayMedia("/local_source/media/test.mp3", "audio/mpeg")
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_source.async_resolve_media",
|
||||
|
||||
Reference in new issue
Block a user