Add tests for configuration validation errors (#103848)

* Add tests for configuration validation errors

* Use absolute path for hass.config.config_dir

* Apply suggestions from code review

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Erik Montnemery
2023-11-13 07:25:58 +01:00
committed by GitHub
parent 50a65fc8c4
commit d0efea3dbd
21 changed files with 241 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
iot_domain:
# This is correct and should not generate errors
- platform: non_adr_0007
option1: abc
# This violates the non_adr_0007.iot_domain platform schema
- platform: non_adr_0007
option1: 123
# This violates the iot_domain platform schema
- paltfrom: non_adr_0007
# This is correct and should not generate errors
adr_0007_1:
host: blah.com
# Host is missing
adr_0007_2:
# Port is wrong type
adr_0007_3:
host: blah.com
port: foo

View File

@@ -0,0 +1,4 @@
iot_domain: !include integrations/iot_domain.yaml
adr_0007_1: !include integrations/adr_0007_1.yaml
adr_0007_2: !include integrations/adr_0007_2.yaml
adr_0007_3: !include integrations/adr_0007_3.yaml

View File

@@ -0,0 +1,2 @@
# This is correct and should not generate errors
host: blah.com

View File

@@ -0,0 +1 @@
# Host is missing

View File

@@ -0,0 +1,3 @@
# Port is wrong type
host: blah.com
port: foo

View File

@@ -0,0 +1,8 @@
# This is correct and should not generate errors
- platform: non_adr_0007
option1: abc
# This violates the non_adr_0007.iot_domain platform schema
- platform: non_adr_0007
option1: 123
# This violates the iot_domain platform schema
- paltfrom: non_adr_0007

View File

@@ -0,0 +1 @@
iot_domain: !include_dir_list iot_domain

View File

@@ -0,0 +1,3 @@
# This is correct and should not generate errors
platform: non_adr_0007
option1: abc

View File

@@ -0,0 +1,3 @@
# This violates the non_adr_0007.iot_domain platform schema
platform: non_adr_0007
option1: 123

View File

@@ -0,0 +1,2 @@
# This violates the iot_domain platform schema
paltfrom: non_adr_0007

View File

@@ -0,0 +1 @@
iot_domain: !include_dir_merge_list iot_domain

View File

@@ -0,0 +1,3 @@
# This is correct and should not generate errors
- platform: non_adr_0007
option1: abc

View File

@@ -0,0 +1,5 @@
# This violates the non_adr_0007.iot_domain platform schema
- platform: non_adr_0007
option1: 123
# This violates the iot_domain platform schema
- paltfrom: non_adr_0007

View File

@@ -0,0 +1,28 @@
homeassistant:
packages:
pack_1:
iot_domain:
# This is correct and should not generate errors
- platform: non_adr_0007
option1: abc
pack_2:
iot_domain:
# This violates the non_adr_0007.iot_domain platform schema
- platform: non_adr_0007
option1: 123
pack_3:
iot_domain:
# This violates the iot_domain platform schema
- paltfrom: non_adr_0007
pack_4:
# This is correct and should not generate errors
adr_0007_1:
host: blah.com
pack_5:
# Host is missing
adr_0007_2:
pack_6:
# Port is wrong type
adr_0007_3:
host: blah.com
port: foo

View File

@@ -0,0 +1,3 @@
homeassistant:
# Load packages
packages: !include_dir_named integrations

View File

@@ -0,0 +1,3 @@
# This is correct and should not generate errors
adr_0007_1:
host: blah.com

View File

@@ -0,0 +1,2 @@
# Host is missing
adr_0007_2:

View File

@@ -0,0 +1,4 @@
# Port is wrong type
adr_0007_3:
host: blah.com
port: foo

View File

@@ -0,0 +1,9 @@
iot_domain:
# This is correct and should not generate errors
- platform: non_adr_0007
option1: abc
# This violates the non_adr_0007.iot_domain platform schema
- platform: non_adr_0007
option1: 123
# This violates the iot_domain platform schema
- paltfrom: non_adr_0007