mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +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(
|
||||
self.blueprint.data, self.inputs_with_default
|
||||
)
|
||||
combined = {**self.config_with_inputs, **processed}
|
||||
combined = {**processed, **self.config_with_inputs}
|
||||
# From config_with_inputs
|
||||
combined.pop(CONF_USE_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."""
|
||||
inputs = models.BlueprintInputs(
|
||||
blueprint_1,
|
||||
{"use_blueprint": {"path": "bla", "input": {"test-placeholder": 1}}},
|
||||
blueprint_2,
|
||||
{
|
||||
"use_blueprint": {
|
||||
"path": "bla",
|
||||
"input": {"test-placeholder": 1, "test-placeholder-default": 12},
|
||||
},
|
||||
"example-default": {"overridden": "via-config"},
|
||||
},
|
||||
)
|
||||
inputs.validate()
|
||||
assert inputs.inputs == {"test-placeholder": 1}
|
||||
assert inputs.async_substitute() == {"example": 1}
|
||||
assert inputs.inputs == {"test-placeholder": 1, "test-placeholder-default": 12}
|
||||
assert inputs.async_substitute() == {
|
||||
"example": 1,
|
||||
"example-default": {"overridden": "via-config"},
|
||||
}
|
||||
|
||||
|
||||
def test_blueprint_inputs_validation(blueprint_1):
|
||||
|
Loading…
x
Reference in New Issue
Block a user