Add generic command/button functionality to webostv (#30379)

* add generic command/button functionality to webostv

* update codeowners
This commit is contained in:
Josh Bendavid authored and springstan committed 2020-01-02 22:32:56 +01:00
1 parent 9064058a03
commit c1936f6fe4
6 files changed
+124 -3

No files matched your search

+38 -1
View File
@@ -9,7 +9,13 @@ from homeassistant.components.media_player.const import (
ATTR_MEDIA_VOLUME_MUTED,
SERVICE_SELECT_SOURCE,
)
from homeassistant.components.webostv import DOMAIN
from homeassistant.components.webostv import (
ATTR_BUTTON,
ATTR_COMMAND,
DOMAIN,
SERVICE_BUTTON,
SERVICE_COMMAND,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_HOST,
@@ -75,3 +81,34 @@ async def test_select_source_with_empty_source_list(hass, client):
assert hass.states.is_state(ENTITY_ID, "playing")
client.launch_app.assert_not_called()
client.set_input.assert_not_called()
async def test_button(hass, client):
"""Test generic button functionality."""
await setup_webostv(hass)
data = {
ATTR_ENTITY_ID: ENTITY_ID,
ATTR_BUTTON: "test",
}
await hass.services.async_call(DOMAIN, SERVICE_BUTTON, data)
await hass.async_block_till_done()
client.button.assert_called_once()
client.button.assert_called_with("test")
async def test_command(hass, client):
"""Test generic button functionality."""
await setup_webostv(hass)
data = {
ATTR_ENTITY_ID: ENTITY_ID,
ATTR_COMMAND: "test",
}
await hass.services.async_call(DOMAIN, SERVICE_COMMAND, data)
await hass.async_block_till_done()
client.request.assert_called_with("test")