mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add test for check_config helper (#102898)
This commit is contained in:
parent
7f5896bc45
commit
6f515c06a2
@ -159,7 +159,7 @@ async def test_component_platform_not_found_2(hass: HomeAssistant) -> None:
|
|||||||
|
|
||||||
|
|
||||||
async def test_platform_not_found_recovery_mode(hass: HomeAssistant) -> None:
|
async def test_platform_not_found_recovery_mode(hass: HomeAssistant) -> None:
|
||||||
"""Test no errors if platform not found in recovery_mode."""
|
"""Test no errors if platform not found in recovery mode."""
|
||||||
# Make sure they don't exist
|
# Make sure they don't exist
|
||||||
files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"}
|
files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"}
|
||||||
hass.config.recovery_mode = True
|
hass.config.recovery_mode = True
|
||||||
@ -173,6 +173,21 @@ async def test_platform_not_found_recovery_mode(hass: HomeAssistant) -> None:
|
|||||||
assert not res.errors
|
assert not res.errors
|
||||||
|
|
||||||
|
|
||||||
|
async def test_platform_not_found_safe_mode(hass: HomeAssistant) -> None:
|
||||||
|
"""Test no errors if platform not found in safe mode."""
|
||||||
|
# Make sure they don't exist
|
||||||
|
files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"}
|
||||||
|
hass.config.safe_mode = True
|
||||||
|
with patch("os.path.isfile", return_value=True), patch_yaml_files(files):
|
||||||
|
res = await async_check_ha_config_file(hass)
|
||||||
|
log_ha_config(res)
|
||||||
|
|
||||||
|
assert res.keys() == {"homeassistant", "light"}
|
||||||
|
assert res["light"] == []
|
||||||
|
|
||||||
|
assert not res.errors
|
||||||
|
|
||||||
|
|
||||||
async def test_package_invalid(hass: HomeAssistant) -> None:
|
async def test_package_invalid(hass: HomeAssistant) -> None:
|
||||||
"""Test a valid platform setup."""
|
"""Test a valid platform setup."""
|
||||||
files = {YAML_CONFIG_FILE: BASE_CONFIG + ' packages:\n p1:\n group: ["a"]'}
|
files = {YAML_CONFIG_FILE: BASE_CONFIG + ' packages:\n p1:\n group: ["a"]'}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user