Feature alexa launch request (#8730)
* Add support for LaunchRequest alexa intent * Support LaunchRequest for multiple skills * formatting * adding tests to cover launch request * formatting
This commit is contained in:
1 parent
47dad547eb
commit
1adb5040e7
2 files changed
+48
-10
No files matched your search
@@ -100,6 +100,12 @@ def alexa_client(loop, hass, test_client):
|
||||
},
|
||||
"entity_id": "switch.test",
|
||||
}
|
||||
},
|
||||
APPLICATION_ID: {
|
||||
"speech": {
|
||||
"type": "plain",
|
||||
"text": "LaunchRequest has been received.",
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
@@ -140,8 +146,41 @@ def test_intent_launch_request(alexa_client):
|
||||
}
|
||||
req = yield from _intent_req(alexa_client, data)
|
||||
assert req.status == 200
|
||||
resp = yield from req.json()
|
||||
assert "outputSpeech" in resp["response"]
|
||||
data = yield from req.json()
|
||||
text = data.get("response", {}).get("outputSpeech",
|
||||
{}).get("text")
|
||||
assert text == "LaunchRequest has been received."
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_intent_launch_request_not_configured(alexa_client):
|
||||
"""Test the launch of a request."""
|
||||
data = {
|
||||
"version": "1.0",
|
||||
"session": {
|
||||
"new": True,
|
||||
"sessionId": SESSION_ID,
|
||||
"application": {
|
||||
"applicationId":
|
||||
'amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00000'
|
||||
},
|
||||
"attributes": {},
|
||||
"user": {
|
||||
"userId": "amzn1.account.AM3B00000000000000000000000"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"type": "LaunchRequest",
|
||||
"requestId": REQUEST_ID,
|
||||
"timestamp": "2015-05-13T12:34:56Z"
|
||||
}
|
||||
}
|
||||
req = yield from _intent_req(alexa_client, data)
|
||||
assert req.status == 200
|
||||
data = yield from req.json()
|
||||
text = data.get("response", {}).get("outputSpeech",
|
||||
{}).get("text")
|
||||
assert text == "This intent is not yet configured within Home Assistant."
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
|
||||
Reference in new issue
Block a user