mirror of
https://github.com/home-assistant/core.git
synced 2025-06-20 13:07:09 +00:00
Filter out duplicate app names from vizio's source list (#33051)
* filter out additional app config names from pyvizios app list * add test * change where filtering app list occurs * fix test * fix mistake in change * hopefully final test fix * fix test scenario that unknowingly broke with test change
This commit is contained in:
parent
912cda4e6f
commit
ca3a22b5a3
@ -335,7 +335,11 @@ class VizioDevice(MediaPlayerDevice):
|
|||||||
if _input not in INPUT_APPS
|
if _input not in INPUT_APPS
|
||||||
],
|
],
|
||||||
*self._available_apps,
|
*self._available_apps,
|
||||||
*self._get_additional_app_names(),
|
*[
|
||||||
|
app
|
||||||
|
for app in self._get_additional_app_names()
|
||||||
|
if app not in self._available_apps
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
return self._available_inputs
|
return self._available_inputs
|
||||||
|
@ -70,10 +70,9 @@ INPUT_LIST = ["HDMI", "USB", "Bluetooth", "AUX"]
|
|||||||
CURRENT_APP = "Hulu"
|
CURRENT_APP = "Hulu"
|
||||||
APP_LIST = ["Hulu", "Netflix"]
|
APP_LIST = ["Hulu", "Netflix"]
|
||||||
INPUT_LIST_WITH_APPS = INPUT_LIST + ["CAST"]
|
INPUT_LIST_WITH_APPS = INPUT_LIST + ["CAST"]
|
||||||
CUSTOM_APP_NAME = "APP3"
|
|
||||||
CUSTOM_CONFIG = {CONF_APP_ID: "test", CONF_MESSAGE: None, CONF_NAME_SPACE: 10}
|
CUSTOM_CONFIG = {CONF_APP_ID: "test", CONF_MESSAGE: None, CONF_NAME_SPACE: 10}
|
||||||
ADDITIONAL_APP_CONFIG = {
|
ADDITIONAL_APP_CONFIG = {
|
||||||
"name": CUSTOM_APP_NAME,
|
"name": CURRENT_APP,
|
||||||
CONF_CONFIG: CUSTOM_CONFIG,
|
CONF_CONFIG: CUSTOM_CONFIG,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,6 @@ from .const import (
|
|||||||
APP_LIST,
|
APP_LIST,
|
||||||
CURRENT_APP,
|
CURRENT_APP,
|
||||||
CURRENT_INPUT,
|
CURRENT_INPUT,
|
||||||
CUSTOM_APP_NAME,
|
|
||||||
CUSTOM_CONFIG,
|
CUSTOM_CONFIG,
|
||||||
ENTITY_ID,
|
ENTITY_ID,
|
||||||
INPUT_LIST,
|
INPUT_LIST,
|
||||||
@ -180,11 +179,15 @@ async def _test_setup_with_apps(
|
|||||||
+ [
|
+ [
|
||||||
app["name"]
|
app["name"]
|
||||||
for app in device_config[CONF_APPS][CONF_ADDITIONAL_CONFIGS]
|
for app in device_config[CONF_APPS][CONF_ADDITIONAL_CONFIGS]
|
||||||
|
if app["name"] not in APP_LIST
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
list_to_test = list(INPUT_LIST_WITH_APPS + APP_LIST)
|
list_to_test = list(INPUT_LIST_WITH_APPS + APP_LIST)
|
||||||
|
|
||||||
|
if CONF_ADDITIONAL_CONFIGS in device_config.get(CONF_APPS, {}):
|
||||||
|
assert attr["source_list"].count(CURRENT_APP) == 1
|
||||||
|
|
||||||
for app_to_remove in INPUT_APPS:
|
for app_to_remove in INPUT_APPS:
|
||||||
if app_to_remove in list_to_test:
|
if app_to_remove in list_to_test:
|
||||||
list_to_test.remove(app_to_remove)
|
list_to_test.remove(app_to_remove)
|
||||||
@ -471,14 +474,14 @@ async def test_setup_with_apps_additional_apps_config(
|
|||||||
hass,
|
hass,
|
||||||
"launch_app",
|
"launch_app",
|
||||||
SERVICE_SELECT_SOURCE,
|
SERVICE_SELECT_SOURCE,
|
||||||
{ATTR_INPUT_SOURCE: CURRENT_APP},
|
{ATTR_INPUT_SOURCE: "Netflix"},
|
||||||
CURRENT_APP,
|
"Netflix",
|
||||||
)
|
)
|
||||||
await _test_service(
|
await _test_service(
|
||||||
hass,
|
hass,
|
||||||
"launch_app_config",
|
"launch_app_config",
|
||||||
SERVICE_SELECT_SOURCE,
|
SERVICE_SELECT_SOURCE,
|
||||||
{ATTR_INPUT_SOURCE: CUSTOM_APP_NAME},
|
{ATTR_INPUT_SOURCE: CURRENT_APP},
|
||||||
**CUSTOM_CONFIG,
|
**CUSTOM_CONFIG,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user