mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 18:08:37 -04:00
Replace dots in Alexa built-in intent slots w/ underscores (#5092)
* Replace dots in built-in intent slots w/ underscores * Add a built-in intent test
This commit is contained in:
committed by
Paulus Schoutsen
parent
aaff8d8602
commit
a2f17cccbb
@@ -101,6 +101,12 @@ def setUpModule():
|
||||
"text": "You told us your sign is {{ ZodiacSign }}.",
|
||||
}
|
||||
},
|
||||
"AMAZON.PlaybackAction<object@MusicCreativeWork>": {
|
||||
"speech": {
|
||||
"type": "plaintext",
|
||||
"text": "Playing {{ object_byArtist_name }}.",
|
||||
}
|
||||
},
|
||||
"CallServiceIntent": {
|
||||
"speech": {
|
||||
"type": "plaintext",
|
||||
@@ -376,6 +382,65 @@ class TestAlexa(unittest.TestCase):
|
||||
self.assertEqual(200, req.status_code)
|
||||
self.assertEqual("", req.text)
|
||||
|
||||
def test_intent_from_built_in_intent_library(self):
|
||||
"""Test intents from the Built-in Intent Library."""
|
||||
data = {
|
||||
'request': {
|
||||
'intent': {
|
||||
'name': 'AMAZON.PlaybackAction<object@MusicCreativeWork>',
|
||||
'slots': {
|
||||
'object.byArtist.name': {
|
||||
'name': 'object.byArtist.name',
|
||||
'value': 'the shins'
|
||||
},
|
||||
'object.composer.name': {
|
||||
'name': 'object.composer.name'
|
||||
},
|
||||
'object.contentSource': {
|
||||
'name': 'object.contentSource'
|
||||
},
|
||||
'object.era': {
|
||||
'name': 'object.era'
|
||||
},
|
||||
'object.genre': {
|
||||
'name': 'object.genre'
|
||||
},
|
||||
'object.name': {
|
||||
'name': 'object.name'
|
||||
},
|
||||
'object.owner.name': {
|
||||
'name': 'object.owner.name'
|
||||
},
|
||||
'object.select': {
|
||||
'name': 'object.select'
|
||||
},
|
||||
'object.sort': {
|
||||
'name': 'object.sort'
|
||||
},
|
||||
'object.type': {
|
||||
'name': 'object.type',
|
||||
'value': 'music'
|
||||
}
|
||||
}
|
||||
},
|
||||
'timestamp': '2016-12-14T23:23:37Z',
|
||||
'type': 'IntentRequest',
|
||||
'requestId': REQUEST_ID,
|
||||
|
||||
},
|
||||
'session': {
|
||||
'sessionId': SESSION_ID,
|
||||
'application': {
|
||||
'applicationId': APPLICATION_ID
|
||||
}
|
||||
}
|
||||
}
|
||||
req = _intent_req(data)
|
||||
self.assertEqual(200, req.status_code)
|
||||
text = req.json().get("response", {}).get("outputSpeech",
|
||||
{}).get("text")
|
||||
self.assertEqual("Playing the shins.", text)
|
||||
|
||||
def test_flash_briefing_invalid_id(self):
|
||||
"""Test an invalid Flash Briefing ID."""
|
||||
req = _flash_briefing_req()
|
||||
|
||||
Reference in New Issue
Block a user