Load custom sentences for language variations (en-us, etc.) (#88498)

This commit is contained in:
Michael Hansen 2023-02-20 11:28:04 -06:00 committed by GitHub
parent 7119a0f811
commit 5bf3a0b7af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 21 deletions

View file

@ -595,12 +595,18 @@ async def test_custom_sentences(
# Expecting testing_config/custom_sentences/en/beer.yaml
intent.async_register(hass, OrderBeerIntentHandler())
# Don't use "en" to test loading custom sentences with language variants.
language = "en-us"
# Invoke intent via HTTP API
client = await hass_client()
for beer_style in ("stout", "lager"):
resp = await client.post(
"/api/conversation/process",
json={"text": f"I'd like to order a {beer_style}, please"},
json={
"text": f"I'd like to order a {beer_style}, please",
"language": language,
},
)
assert resp.status == HTTPStatus.OK
data = await resp.json()
@ -614,7 +620,7 @@ async def test_custom_sentences(
"speech": f"You ordered a {beer_style}",
}
},
"language": hass.config.language,
"language": language,
"response_type": "action_done",
"data": {
"targets": [],