Move components to folders (#20774)

* Move all components into folders

* Move component tests into folders

* Fix init moving

* Move tests

* Lint

* Update coverage

* Fix service descriptions

* Update CODEOWNERS
This commit is contained in:
Paulus Schoutsen 2019-02-05 19:31:15 -08:00 committed by GitHub
parent d13b2ca6ef
commit b8cc547fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
275 changed files with 512 additions and 684 deletions

View file

@ -0,0 +1,45 @@
"""Test intent_script component."""
import asyncio
from homeassistant.bootstrap import async_setup_component
from homeassistant.helpers import intent
from tests.common import async_mock_service
@asyncio.coroutine
def test_intent_script(hass):
"""Test intent scripts work."""
calls = async_mock_service(hass, 'test', 'service')
yield from async_setup_component(hass, 'intent_script', {
'intent_script': {
'HelloWorld': {
'action': {
'service': 'test.service',
'data_template': {
'hello': '{{ name }}'
}
},
'card': {
'title': 'Hello {{ name }}',
'content': 'Content for {{ name }}',
},
'speech': {
'text': 'Good morning {{ name }}'
}
}
}
})
response = yield from intent.async_handle(
hass, 'test', 'HelloWorld', {'name': {'value': 'Paulus'}}
)
assert len(calls) == 1
assert calls[0].data['hello'] == 'Paulus'
assert response.speech['plain']['speech'] == 'Good morning Paulus'
assert response.card['simple']['title'] == 'Hello Paulus'
assert response.card['simple']['content'] == 'Content for Paulus'