Alexa to not use customize for entity config (#11461)
* Alexa to not use customize for entity config * Test Alexa entity config * Improve tests * Fix test
This commit is contained in:
1 parent
71fb7a6ef6
commit
8b57777ce9
5 files changed
+140
-57
No files matched your search
@@ -9,7 +9,7 @@ from homeassistant.helpers import entityfilter
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
DEFAULT_CONFIG = smart_home.Config(filter=lambda entity_id: True)
|
||||
DEFAULT_CONFIG = smart_home.Config(should_expose=lambda entity_id: True)
|
||||
|
||||
|
||||
def get_new_request(namespace, name, endpoint=None):
|
||||
@@ -338,7 +338,7 @@ def test_exclude_filters(hass):
|
||||
hass.states.async_set(
|
||||
'cover.deny', 'off', {'friendly_name': "Blocked cover"})
|
||||
|
||||
config = smart_home.Config(filter=entityfilter.generate_filter(
|
||||
config = smart_home.Config(should_expose=entityfilter.generate_filter(
|
||||
include_domains=[],
|
||||
include_entities=[],
|
||||
exclude_domains=['script'],
|
||||
@@ -371,7 +371,7 @@ def test_include_filters(hass):
|
||||
hass.states.async_set(
|
||||
'group.allow', 'off', {'friendly_name': "Allowed group"})
|
||||
|
||||
config = smart_home.Config(filter=entityfilter.generate_filter(
|
||||
config = smart_home.Config(should_expose=entityfilter.generate_filter(
|
||||
include_domains=['automation', 'group'],
|
||||
include_entities=['script.deny'],
|
||||
exclude_domains=[],
|
||||
@@ -1116,3 +1116,40 @@ def test_api_mute(hass, domain):
|
||||
assert len(call) == 1
|
||||
assert call[0].data['entity_id'] == '{}.test'.format(domain)
|
||||
assert msg['header']['name'] == 'Response'
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_entity_config(hass):
|
||||
"""Test that we can configure things via entity config."""
|
||||
request = get_new_request('Alexa.Discovery', 'Discover')
|
||||
|
||||
hass.states.async_set(
|
||||
'light.test_1', 'on', {'friendly_name': "Test light 1"})
|
||||
|
||||
config = smart_home.Config(
|
||||
should_expose=lambda entity_id: True,
|
||||
entity_config={
|
||||
'light.test_1': {
|
||||
'name': 'Config name',
|
||||
'display_categories': 'SWITCH',
|
||||
'description': 'Config description'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
msg = yield from smart_home.async_handle_message(
|
||||
hass, config, request)
|
||||
|
||||
assert 'event' in msg
|
||||
msg = msg['event']
|
||||
|
||||
assert len(msg['payload']['endpoints']) == 1
|
||||
|
||||
appliance = msg['payload']['endpoints'][0]
|
||||
assert appliance['endpointId'] == 'light#test_1'
|
||||
assert appliance['displayCategories'][0] == "SWITCH"
|
||||
assert appliance['friendlyName'] == "Config name"
|
||||
assert appliance['description'] == "Config description"
|
||||
assert len(appliance['capabilities']) == 1
|
||||
assert appliance['capabilities'][-1]['interface'] == \
|
||||
'Alexa.PowerController'
|
||||
Reference in new issue
Block a user