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:
21
tests/fixtures/core/config/basic/configuration.yaml
vendored
Normal file
21
tests/fixtures/core/config/basic/configuration.yaml
vendored
Normal 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
|
||||
4
tests/fixtures/core/config/basic_include/configuration.yaml
vendored
Normal file
4
tests/fixtures/core/config/basic_include/configuration.yaml
vendored
Normal 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
|
||||
2
tests/fixtures/core/config/basic_include/integrations/adr_0007_1.yaml
vendored
Normal file
2
tests/fixtures/core/config/basic_include/integrations/adr_0007_1.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# This is correct and should not generate errors
|
||||
host: blah.com
|
||||
1
tests/fixtures/core/config/basic_include/integrations/adr_0007_2.yaml
vendored
Normal file
1
tests/fixtures/core/config/basic_include/integrations/adr_0007_2.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# Host is missing
|
||||
3
tests/fixtures/core/config/basic_include/integrations/adr_0007_3.yaml
vendored
Normal file
3
tests/fixtures/core/config/basic_include/integrations/adr_0007_3.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Port is wrong type
|
||||
host: blah.com
|
||||
port: foo
|
||||
8
tests/fixtures/core/config/basic_include/integrations/iot_domain.yaml
vendored
Normal file
8
tests/fixtures/core/config/basic_include/integrations/iot_domain.yaml
vendored
Normal 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
|
||||
1
tests/fixtures/core/config/include_dir_list/configuration.yaml
vendored
Normal file
1
tests/fixtures/core/config/include_dir_list/configuration.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
iot_domain: !include_dir_list iot_domain
|
||||
3
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_1.yaml
vendored
Normal file
3
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_1.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This is correct and should not generate errors
|
||||
platform: non_adr_0007
|
||||
option1: abc
|
||||
3
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_2.yaml
vendored
Normal file
3
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_2.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This violates the non_adr_0007.iot_domain platform schema
|
||||
platform: non_adr_0007
|
||||
option1: 123
|
||||
2
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_3.yaml
vendored
Normal file
2
tests/fixtures/core/config/include_dir_list/iot_domain/iot_domain_3.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# This violates the iot_domain platform schema
|
||||
paltfrom: non_adr_0007
|
||||
1
tests/fixtures/core/config/include_dir_merge_list/configuration.yaml
vendored
Normal file
1
tests/fixtures/core/config/include_dir_merge_list/configuration.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
iot_domain: !include_dir_merge_list iot_domain
|
||||
3
tests/fixtures/core/config/include_dir_merge_list/iot_domain/iot_domain_1.yaml
vendored
Normal file
3
tests/fixtures/core/config/include_dir_merge_list/iot_domain/iot_domain_1.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This is correct and should not generate errors
|
||||
- platform: non_adr_0007
|
||||
option1: abc
|
||||
5
tests/fixtures/core/config/include_dir_merge_list/iot_domain/iot_domain_2.yaml
vendored
Normal file
5
tests/fixtures/core/config/include_dir_merge_list/iot_domain/iot_domain_2.yaml
vendored
Normal 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
|
||||
28
tests/fixtures/core/config/packages/configuration.yaml
vendored
Normal file
28
tests/fixtures/core/config/packages/configuration.yaml
vendored
Normal 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
|
||||
3
tests/fixtures/core/config/packages_include_dir_named/configuration.yaml
vendored
Normal file
3
tests/fixtures/core/config/packages_include_dir_named/configuration.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
homeassistant:
|
||||
# Load packages
|
||||
packages: !include_dir_named integrations
|
||||
3
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_1.yaml
vendored
Normal file
3
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_1.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# This is correct and should not generate errors
|
||||
adr_0007_1:
|
||||
host: blah.com
|
||||
2
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_2.yaml
vendored
Normal file
2
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_2.yaml
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Host is missing
|
||||
adr_0007_2:
|
||||
4
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_3.yaml
vendored
Normal file
4
tests/fixtures/core/config/packages_include_dir_named/integrations/adr_0007_3.yaml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# Port is wrong type
|
||||
adr_0007_3:
|
||||
host: blah.com
|
||||
port: foo
|
||||
9
tests/fixtures/core/config/packages_include_dir_named/integrations/iot_domain.yaml
vendored
Normal file
9
tests/fixtures/core/config/packages_include_dir_named/integrations/iot_domain.yaml
vendored
Normal 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
|
||||
Reference in New Issue
Block a user