Remove legacy script mode and simplify remaining modes (#37729)

This commit is contained in:
Phil Bruckner 2020-07-10 19:00:57 -05:00 committed by GitHub
parent 8a8289b1a4
commit 63e55bff52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 407 additions and 959 deletions

View file

@ -5,7 +5,7 @@ from unittest import mock
import pytest
import homeassistant.components.automation as automation
from homeassistant.core import Context
from homeassistant.core import Context, callback
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@ -435,6 +435,7 @@ async def test_wait_template_with_trigger(hass, calls):
"value_template": "{{ states.test.entity.state == 'world' }}",
},
"action": [
{"event": "test_event"},
{"wait_template": "{{ is_state(trigger.entity_id, 'hello') }}"},
{
"service": "test.automation",
@ -458,10 +459,14 @@ async def test_wait_template_with_trigger(hass, calls):
await hass.async_block_till_done()
@callback
def event_handler(event):
hass.states.async_set("test.entity", "hello")
hass.bus.async_listen_once("test_event", event_handler)
hass.states.async_set("test.entity", "world")
await hass.async_block_till_done()
hass.states.async_set("test.entity", "hello")
await hass.async_block_till_done()
assert len(calls) == 1
assert calls[0].data["some"] == "template - test.entity - hello - world - None"