mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Merge branch 'dev' into esphome_bronze
This commit is contained in:
commit
9b9c10b0c7
@ -68,6 +68,9 @@
|
|||||||
"repeat_set": {
|
"repeat_set": {
|
||||||
"service": "mdi:repeat"
|
"service": "mdi:repeat"
|
||||||
},
|
},
|
||||||
|
"search_media": {
|
||||||
|
"service": "mdi:text-search"
|
||||||
|
},
|
||||||
"select_sound_mode": {
|
"select_sound_mode": {
|
||||||
"service": "mdi:surround-sound"
|
"service": "mdi:surround-sound"
|
||||||
},
|
},
|
||||||
|
@ -181,6 +181,35 @@ browse_media:
|
|||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
|
|
||||||
|
search_media:
|
||||||
|
target:
|
||||||
|
entity:
|
||||||
|
domain: media_player
|
||||||
|
supported_features:
|
||||||
|
- media_player.MediaPlayerEntityFeature.SEARCH_MEDIA
|
||||||
|
fields:
|
||||||
|
search_query:
|
||||||
|
required: true
|
||||||
|
example: "Beatles"
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
media_content_type:
|
||||||
|
required: false
|
||||||
|
example: "music"
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
media_content_id:
|
||||||
|
required: false
|
||||||
|
example: "A:ALBUMARTIST/Beatles"
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
media_filter_classes:
|
||||||
|
required: false
|
||||||
|
example: ["album", "artist"]
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
multiple: true
|
||||||
|
|
||||||
select_source:
|
select_source:
|
||||||
target:
|
target:
|
||||||
entity:
|
entity:
|
||||||
|
@ -274,6 +274,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"search_media": {
|
||||||
|
"name": "Search media",
|
||||||
|
"description": "Searches the available media.",
|
||||||
|
"fields": {
|
||||||
|
"media_content_id": {
|
||||||
|
"name": "[%key:component::media_player::services::browse_media::fields::media_content_id::name%]",
|
||||||
|
"description": "[%key:component::media_player::services::browse_media::fields::media_content_id::description%]"
|
||||||
|
},
|
||||||
|
"media_content_type": {
|
||||||
|
"name": "[%key:component::media_player::services::browse_media::fields::media_content_type::name%]",
|
||||||
|
"description": "[%key:component::media_player::services::browse_media::fields::media_content_type::description%]"
|
||||||
|
},
|
||||||
|
"search_query": {
|
||||||
|
"name": "Search query",
|
||||||
|
"description": "The term to search for."
|
||||||
|
},
|
||||||
|
"media_filter_classes": {
|
||||||
|
"name": "Media filter classes",
|
||||||
|
"description": "List of media classes to filter the search results by."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"select_source": {
|
"select_source": {
|
||||||
"name": "Select source",
|
"name": "Select source",
|
||||||
"description": "Sends the media player the command to change input source.",
|
"description": "Sends the media player the command to change input source.",
|
||||||
|
@ -81,6 +81,7 @@ async def test_restore_dashboard_storage_end_to_end(
|
|||||||
assert mock_dashboard_api.mock_calls[0][1][0] == "http://new-host:6052"
|
assert mock_dashboard_api.mock_calls[0][1][0] == "http://new-host:6052"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("hassio_stubs")
|
||||||
async def test_restore_dashboard_storage_skipped_if_addon_uninstalled(
|
async def test_restore_dashboard_storage_skipped_if_addon_uninstalled(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
@ -105,9 +106,7 @@ async def test_restore_dashboard_storage_skipped_if_addon_uninstalled(
|
|||||||
return_value={},
|
return_value={},
|
||||||
),
|
),
|
||||||
):
|
):
|
||||||
await async_setup_component(hass, "hassio", {})
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
|
||||||
await async_setup_component(hass, DOMAIN, {})
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert "test-slug is no longer installed" in caplog.text
|
assert "test-slug is no longer installed" in caplog.text
|
||||||
assert not mock_dashboard_api.called
|
assert not mock_dashboard_api.called
|
||||||
|
@ -3,17 +3,16 @@
|
|||||||
from collections.abc import Generator
|
from collections.abc import Generator
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
from aiohasupervisor.models import AddonsStats, AddonState
|
from aiohasupervisor.models import AddonsStats, AddonState
|
||||||
from aiohttp.test_utils import TestClient
|
from aiohttp.test_utils import TestClient
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.auth.models import RefreshToken
|
from homeassistant.auth.models import RefreshToken
|
||||||
from homeassistant.components.hassio.handler import HassIO, HassioAPIError
|
from homeassistant.components.hassio.handler import HassIO
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.setup import async_setup_component
|
|
||||||
|
|
||||||
from . import SUPERVISOR_TOKEN
|
from . import SUPERVISOR_TOKEN
|
||||||
|
|
||||||
@ -31,55 +30,6 @@ def disable_security_filter() -> Generator[None]:
|
|||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def hassio_env(supervisor_is_connected: AsyncMock) -> Generator[None]:
|
|
||||||
"""Fixture to inject hassio env."""
|
|
||||||
with (
|
|
||||||
patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}),
|
|
||||||
patch.dict(os.environ, {"SUPERVISOR_TOKEN": SUPERVISOR_TOKEN}),
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.HassIO.get_info",
|
|
||||||
Mock(side_effect=HassioAPIError()),
|
|
||||||
),
|
|
||||||
):
|
|
||||||
yield
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
async def hassio_stubs(
|
|
||||||
hassio_env: None,
|
|
||||||
hass: HomeAssistant,
|
|
||||||
hass_client: ClientSessionGenerator,
|
|
||||||
aioclient_mock: AiohttpClientMocker,
|
|
||||||
supervisor_client: AsyncMock,
|
|
||||||
) -> RefreshToken:
|
|
||||||
"""Create mock hassio http client."""
|
|
||||||
with (
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.HassIO.update_hass_api",
|
|
||||||
return_value={"result": "ok"},
|
|
||||||
) as hass_api,
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.HassIO.update_hass_timezone",
|
|
||||||
return_value={"result": "ok"},
|
|
||||||
),
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.HassIO.get_info",
|
|
||||||
side_effect=HassioAPIError(),
|
|
||||||
),
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.HassIO.get_ingress_panels",
|
|
||||||
return_value={"panels": []},
|
|
||||||
),
|
|
||||||
patch(
|
|
||||||
"homeassistant.components.hassio.issues.SupervisorIssues.setup",
|
|
||||||
),
|
|
||||||
):
|
|
||||||
await async_setup_component(hass, "hassio", {})
|
|
||||||
|
|
||||||
return hass_api.call_args[0][1]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def hassio_client(
|
async def hassio_client(
|
||||||
hassio_stubs: RefreshToken, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
hassio_stubs: RefreshToken, hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||||
|
@ -119,8 +119,10 @@ from .typing import (
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
# Local import to avoid processing recorder and SQLite modules when running a
|
# Local import to avoid processing recorder and SQLite modules when running a
|
||||||
# testcase which does not use the recorder.
|
# testcase which does not use the recorder.
|
||||||
|
from homeassistant.auth.models import RefreshToken
|
||||||
from homeassistant.components import recorder
|
from homeassistant.components import recorder
|
||||||
|
|
||||||
|
|
||||||
pytest.register_assert_rewrite("tests.common")
|
pytest.register_assert_rewrite("tests.common")
|
||||||
|
|
||||||
from .common import ( # noqa: E402, isort:skip
|
from .common import ( # noqa: E402, isort:skip
|
||||||
@ -1894,6 +1896,67 @@ def mock_bleak_scanner_start() -> Generator[MagicMock]:
|
|||||||
yield mock_bleak_scanner_start
|
yield mock_bleak_scanner_start
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def hassio_env(supervisor_is_connected: AsyncMock) -> Generator[None]:
|
||||||
|
"""Fixture to inject hassio env."""
|
||||||
|
from homeassistant.components.hassio import ( # pylint: disable=import-outside-toplevel
|
||||||
|
HassioAPIError,
|
||||||
|
)
|
||||||
|
|
||||||
|
from .components.hassio import ( # pylint: disable=import-outside-toplevel
|
||||||
|
SUPERVISOR_TOKEN,
|
||||||
|
)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch.dict(os.environ, {"SUPERVISOR": "127.0.0.1"}),
|
||||||
|
patch.dict(os.environ, {"SUPERVISOR_TOKEN": SUPERVISOR_TOKEN}),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.HassIO.get_info",
|
||||||
|
Mock(side_effect=HassioAPIError()),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
async def hassio_stubs(
|
||||||
|
hassio_env: None,
|
||||||
|
hass: HomeAssistant,
|
||||||
|
hass_client: ClientSessionGenerator,
|
||||||
|
aioclient_mock: AiohttpClientMocker,
|
||||||
|
supervisor_client: AsyncMock,
|
||||||
|
) -> RefreshToken:
|
||||||
|
"""Create mock hassio http client."""
|
||||||
|
from homeassistant.components.hassio import ( # pylint: disable=import-outside-toplevel
|
||||||
|
HassioAPIError,
|
||||||
|
)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.HassIO.update_hass_api",
|
||||||
|
return_value={"result": "ok"},
|
||||||
|
) as hass_api,
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.HassIO.update_hass_timezone",
|
||||||
|
return_value={"result": "ok"},
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.HassIO.get_info",
|
||||||
|
side_effect=HassioAPIError(),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.HassIO.get_ingress_panels",
|
||||||
|
return_value={"panels": []},
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"homeassistant.components.hassio.issues.SupervisorIssues.setup",
|
||||||
|
),
|
||||||
|
):
|
||||||
|
await async_setup_component(hass, "hassio", {})
|
||||||
|
|
||||||
|
return hass_api.call_args[0][1]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def integration_frame_path() -> str:
|
def integration_frame_path() -> str:
|
||||||
"""Return the path to the integration frame.
|
"""Return the path to the integration frame.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user