mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
More tests
This commit is contained in:
parent
f409a9e7b5
commit
0c7805bc66
@ -380,6 +380,7 @@ async def test_validate_entity(
|
||||
await knx.setup_integration()
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
# valid data
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "knx/validate_entity",
|
||||
@ -412,6 +413,37 @@ async def test_validate_entity(
|
||||
assert res["result"]["errors"][0]["error_message"] == "required key not provided"
|
||||
assert res["result"]["error_base"].startswith("required key not provided")
|
||||
|
||||
# invalid group_select data
|
||||
await client.send_json_auto_id(
|
||||
{
|
||||
"type": "knx/validate_entity",
|
||||
"platform": Platform.LIGHT,
|
||||
"data": {
|
||||
"entity": {"name": "test_name"},
|
||||
"knx": {
|
||||
"color": {
|
||||
"ga_red_brightness": {"write": "1/2/3"},
|
||||
"ga_green_brightness": {"write": "1/2/4"},
|
||||
# ga_blue_brightness is missing - which is required
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
res = await client.receive_json()
|
||||
assert res["success"], res
|
||||
assert res["result"]["success"] is False
|
||||
# This shall test that a required key of the second GroupSelect schema is missing
|
||||
# and not not yield the "extra keys not allowed" error of the first GroupSelect Schema
|
||||
assert res["result"]["errors"][0]["path"] == [
|
||||
"data",
|
||||
"knx",
|
||||
"color",
|
||||
"ga_blue_brightness",
|
||||
]
|
||||
assert res["result"]["errors"][0]["error_message"] == "required key not provided"
|
||||
assert res["result"]["error_base"].startswith("required key not provided")
|
||||
|
||||
|
||||
async def test_migration_1_to_2(
|
||||
hass: HomeAssistant,
|
||||
|
Loading…
x
Reference in New Issue
Block a user