This commit is contained in:
Paulus Schoutsen 2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View file

@ -10,36 +10,36 @@ 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')
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 }}'
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'}}
hass, "test", "HelloWorld", {"name": {"value": "Paulus"}}
)
assert len(calls) == 1
assert calls[0].data['hello'] == 'Paulus'
assert calls[0].data["hello"] == "Paulus"
assert response.speech['plain']['speech'] == 'Good morning Paulus'
assert response.speech["plain"]["speech"] == "Good morning Paulus"
assert response.card['simple']['title'] == 'Hello Paulus'
assert response.card['simple']['content'] == 'Content for Paulus'
assert response.card["simple"]["title"] == "Hello Paulus"
assert response.card["simple"]["content"] == "Content for Paulus"