1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add a service target (#43725)

This commit is contained in:
Paulus Schoutsen
2020-11-28 23:33:32 +01:00
committed by GitHub
parent a2e1efca33
commit dd513147a5
8 changed files with 55 additions and 16 deletions

View File

@@ -175,18 +175,25 @@ class TestServiceHelpers(unittest.TestCase):
"entity_id": "hello.world",
"data": {
"hello": "{{ 'goodbye' }}",
"data": {"value": "{{ 'complex' }}", "simple": "simple"},
"effect": {"value": "{{ 'complex' }}", "simple": "simple"},
},
"data_template": {"list": ["{{ 'list' }}", "2"]},
"target": {"area_id": "test-area-id", "entity_id": "will.be_overridden"},
}
service.call_from_config(self.hass, config)
self.hass.block_till_done()
assert self.calls[0].data["hello"] == "goodbye"
assert self.calls[0].data["data"]["value"] == "complex"
assert self.calls[0].data["data"]["simple"] == "simple"
assert self.calls[0].data["list"][0] == "list"
assert dict(self.calls[0].data) == {
"hello": "goodbye",
"effect": {
"value": "complex",
"simple": "simple",
},
"list": ["list", "2"],
"entity_id": ["hello.world"],
"area_id": ["test-area-id"],
}
def test_service_template_service_call(self):
"""Test legacy service_template call with templating."""