Bump pyvizio version and add additional device info (#31417)

* bump pyvizio version and add additional device info

* add patches for get_model and get_version

* change keywrod argument to positional for _test_service
This commit is contained in:
Raman Gupta authored and GitHub committed 2020-02-03 08:41:58 +01:00
1 parent 744ae82933
commit ee927fbc9e
7 files changed
+38 -21

No files matched your search

+10 -10
View File
@@ -7,8 +7,8 @@ import pytest
from pyvizio.const import (
DEVICE_CLASS_SPEAKER as VIZIO_DEVICE_CLASS_SPEAKER,
DEVICE_CLASS_TV as VIZIO_DEVICE_CLASS_TV,
MAX_VOLUME,
)
from pyvizio.vizio import MAX_VOLUME
from homeassistant.components.media_player import (
ATTR_INPUT_SOURCE,
@@ -111,7 +111,7 @@ async def _test_service(
hass: HomeAssistantType,
vizio_func_name: str,
ha_service_name: str,
additional_service_data: dict = None,
additional_service_data: dict,
*args,
**kwargs,
) -> None:
@@ -194,8 +194,8 @@ async def test_services(
"""Test all Vizio media player entity services."""
await _test_setup(hass, DEVICE_CLASS_TV, True)
await _test_service(hass, "pow_on", SERVICE_TURN_ON)
await _test_service(hass, "pow_off", SERVICE_TURN_OFF)
await _test_service(hass, "pow_on", SERVICE_TURN_ON, None)
await _test_service(hass, "pow_off", SERVICE_TURN_OFF, None)
await _test_service(
hass, "mute_on", SERVICE_VOLUME_MUTE, {ATTR_MEDIA_VOLUME_MUTED: True}
)
@@ -203,18 +203,18 @@ async def test_services(
hass, "mute_off", SERVICE_VOLUME_MUTE, {ATTR_MEDIA_VOLUME_MUTED: False}
)
await _test_service(
hass, "input_switch", SERVICE_SELECT_SOURCE, {ATTR_INPUT_SOURCE: "USB"}, "USB"
hass, "set_input", SERVICE_SELECT_SOURCE, {ATTR_INPUT_SOURCE: "USB"}, "USB"
)
await _test_service(hass, "vol_up", SERVICE_VOLUME_UP)
await _test_service(hass, "vol_down", SERVICE_VOLUME_DOWN)
await _test_service(hass, "vol_up", SERVICE_VOLUME_UP, None)
await _test_service(hass, "vol_down", SERVICE_VOLUME_DOWN, None)
await _test_service(
hass, "vol_up", SERVICE_VOLUME_SET, {ATTR_MEDIA_VOLUME_LEVEL: 1}
)
await _test_service(
hass, "vol_down", SERVICE_VOLUME_SET, {ATTR_MEDIA_VOLUME_LEVEL: 0}
)
await _test_service(hass, "ch_up", SERVICE_MEDIA_NEXT_TRACK)
await _test_service(hass, "ch_down", SERVICE_MEDIA_PREVIOUS_TRACK)
await _test_service(hass, "ch_up", SERVICE_MEDIA_NEXT_TRACK, None)
await _test_service(hass, "ch_down", SERVICE_MEDIA_PREVIOUS_TRACK, None)
async def test_options_update(
@@ -231,7 +231,7 @@ async def test_options_update(
entry=config_entry, options=new_options,
)
assert config_entry.options == updated_options
await _test_service(hass, "vol_up", SERVICE_VOLUME_UP, num=VOLUME_STEP)
await _test_service(hass, "vol_up", SERVICE_VOLUME_UP, None, num=VOLUME_STEP)
async def _test_update_availability_switch(