mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Remove dead code from template from template.config (#196047)
This commit is contained in:
@@ -454,16 +454,6 @@ def _get_option_locations(
|
||||
return locations
|
||||
|
||||
|
||||
async def async_validate_config_section(
|
||||
hass: HomeAssistant, config: ConfigType
|
||||
) -> TemplateConfig:
|
||||
"""Validate an entire config section for the template integration."""
|
||||
|
||||
validated_config = await _async_resolve_template_config(hass, config)
|
||||
await _async_validate_triggers_and_conditions(hass, validated_config)
|
||||
return validated_config
|
||||
|
||||
|
||||
async def async_validate_config(hass: HomeAssistant, config: ConfigType) -> ConfigType:
|
||||
"""Validate config."""
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ from homeassistant.components.template import DOMAIN
|
||||
from homeassistant.components.template.config import (
|
||||
CONFIG_SECTION_SCHEMA,
|
||||
async_validate_config,
|
||||
async_validate_config_section,
|
||||
)
|
||||
from homeassistant.components.template.const import (
|
||||
BINARY_SENSOR_DEPRECATED_ATTRIBUTES,
|
||||
@@ -943,7 +942,7 @@ async def test_combined_state_variables(
|
||||
hass: HomeAssistant, config: dict, expected: dict
|
||||
) -> None:
|
||||
"""Tests combining variables for state based template entities."""
|
||||
validated = await async_validate_config_section(hass, config)
|
||||
validated = (await async_validate_config(hass, {DOMAIN: config}))[DOMAIN][0]
|
||||
assert "variables" not in validated
|
||||
variables: ScriptVariables = validated["button"][0]["variables"]
|
||||
assert variables.as_dict() == expected
|
||||
@@ -1261,7 +1260,7 @@ async def test_combined_trigger_variables(
|
||||
) -> None:
|
||||
"""Tests variable are not combined for trigger based template entities."""
|
||||
empty = ScriptVariables({})
|
||||
validated = await async_validate_config_section(hass, config)
|
||||
validated = (await async_validate_config(hass, {DOMAIN: config}))[DOMAIN][0]
|
||||
root_variables: ScriptVariables = validated.get("variables", empty)
|
||||
assert root_variables.as_dict() == expected_root
|
||||
variables: ScriptVariables = validated["binary_sensor"][0].get("variables", empty)
|
||||
|
||||
Reference in New Issue
Block a user