Add native Python types support to templates (#41227)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Franck Nijhof 2020-10-07 00:05:52 +02:00 committed by GitHub
parent cbb4324c84
commit ee914366a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 349 additions and 282 deletions

View file

@ -5,7 +5,7 @@ from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.vilfo.const import DOMAIN
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST, CONF_ID, CONF_MAC
from tests.async_mock import patch
from tests.async_mock import Mock, patch
async def test_form(hass):
@ -29,6 +29,7 @@ async def test_form(hass):
result["flow_id"],
{CONF_HOST: "testadmin.vilfo.com", CONF_ACCESS_TOKEN: "test-token"},
)
await hass.async_block_till_done()
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["title"] == "testadmin.vilfo.com"
@ -142,7 +143,10 @@ async def test_form_unexpected_exception(hass):
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
with patch("vilfo.Client.ping", side_effect=Exception):
with patch(
"homeassistant.components.vilfo.config_flow.VilfoClient",
) as mock_client:
mock_client.return_value.ping = Mock(side_effect=Exception)
result2 = await hass.config_entries.flow.async_configure(
result["flow_id"],
{"host": "testadmin.vilfo.com", "access_token": "test-token"},