mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Blueprint config to override blueprint (#43724)
This commit is contained in:
parent
6fa3e287da
commit
cb96bd9d0b
@ -172,7 +172,7 @@ class BlueprintInputs:
|
|||||||
processed = placeholder.substitute(
|
processed = placeholder.substitute(
|
||||||
self.blueprint.data, self.inputs_with_default
|
self.blueprint.data, self.inputs_with_default
|
||||||
)
|
)
|
||||||
combined = {**self.config_with_inputs, **processed}
|
combined = {**processed, **self.config_with_inputs}
|
||||||
# From config_with_inputs
|
# From config_with_inputs
|
||||||
combined.pop(CONF_USE_BLUEPRINT)
|
combined.pop(CONF_USE_BLUEPRINT)
|
||||||
# From blueprint
|
# From blueprint
|
||||||
|
@ -133,15 +133,24 @@ def test_blueprint_validate():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_blueprint_inputs(blueprint_1):
|
def test_blueprint_inputs(blueprint_2):
|
||||||
"""Test blueprint inputs."""
|
"""Test blueprint inputs."""
|
||||||
inputs = models.BlueprintInputs(
|
inputs = models.BlueprintInputs(
|
||||||
blueprint_1,
|
blueprint_2,
|
||||||
{"use_blueprint": {"path": "bla", "input": {"test-placeholder": 1}}},
|
{
|
||||||
|
"use_blueprint": {
|
||||||
|
"path": "bla",
|
||||||
|
"input": {"test-placeholder": 1, "test-placeholder-default": 12},
|
||||||
|
},
|
||||||
|
"example-default": {"overridden": "via-config"},
|
||||||
|
},
|
||||||
)
|
)
|
||||||
inputs.validate()
|
inputs.validate()
|
||||||
assert inputs.inputs == {"test-placeholder": 1}
|
assert inputs.inputs == {"test-placeholder": 1, "test-placeholder-default": 12}
|
||||||
assert inputs.async_substitute() == {"example": 1}
|
assert inputs.async_substitute() == {
|
||||||
|
"example": 1,
|
||||||
|
"example-default": {"overridden": "via-config"},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_blueprint_inputs_validation(blueprint_1):
|
def test_blueprint_inputs_validation(blueprint_1):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user