Add support to reprompt user (#65256)
This commit is contained in:
parent
0cfc7112fa
commit
076faaa4a4
5 changed files with 121 additions and 7 deletions
|
@ -40,3 +40,48 @@ async def test_intent_script(hass):
|
|||
|
||||
assert response.card["simple"]["title"] == "Hello Paulus"
|
||||
assert response.card["simple"]["content"] == "Content for Paulus"
|
||||
|
||||
|
||||
async def test_intent_script_wait_response(hass):
|
||||
"""Test intent scripts work."""
|
||||
calls = async_mock_service(hass, "test", "service")
|
||||
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"intent_script",
|
||||
{
|
||||
"intent_script": {
|
||||
"HelloWorldWaitResponse": {
|
||||
"action": {
|
||||
"service": "test.service",
|
||||
"data_template": {"hello": "{{ name }}"},
|
||||
},
|
||||
"card": {
|
||||
"title": "Hello {{ name }}",
|
||||
"content": "Content for {{ name }}",
|
||||
},
|
||||
"speech": {"text": "Good morning {{ name }}"},
|
||||
"reprompt": {
|
||||
"text": "I didn't hear you, {{ name }}... I said good morning!"
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
response = await intent.async_handle(
|
||||
hass, "test", "HelloWorldWaitResponse", {"name": {"value": "Paulus"}}
|
||||
)
|
||||
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data["hello"] == "Paulus"
|
||||
|
||||
assert response.speech["plain"]["speech"] == "Good morning Paulus"
|
||||
|
||||
assert (
|
||||
response.reprompt["plain"]["reprompt"]
|
||||
== "I didn't hear you, Paulus... I said good morning!"
|
||||
)
|
||||
|
||||
assert response.card["simple"]["title"] == "Hello Paulus"
|
||||
assert response.card["simple"]["content"] == "Content for Paulus"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue