Rename experimental UI to lovelace (#15065)

* Rename experimental UI to lovelace

* Bump frontend to 20180620.0
This commit is contained in:
Paulus Schoutsen authored and Paulus Schoutsen committed 2018-06-20 15:13:22 -04:00
1 parent 659616a4eb
commit 49845d9398
5 files changed
+72 -20

No files matched your search

+1
View File
@@ -0,0 +1 @@
"""Tests for the frontend component."""
@@ -5,6 +5,7 @@ from unittest.mock import patch
import pytest
from homeassistant.exceptions import HomeAssistantError
from homeassistant.setup import async_setup_component
from homeassistant.components.frontend import (
DOMAIN, CONF_JS_VERSION, CONF_THEMES, CONF_EXTRA_HTML_URL,
@@ -280,8 +281,8 @@ async def test_get_translations(hass, hass_ws_client):
assert msg['result'] == {'resources': {'lang': 'nl'}}
async def test_experimental_ui(hass, hass_ws_client):
"""Test experimental_ui command."""
async def test_lovelace_ui(hass, hass_ws_client):
"""Test lovelace_ui command."""
await async_setup_component(hass, 'frontend')
client = await hass_ws_client(hass)
@@ -289,7 +290,7 @@ async def test_experimental_ui(hass, hass_ws_client):
return_value={'hello': 'world'}):
await client.send_json({
'id': 5,
'type': 'frontend/experimental_ui',
'type': 'frontend/lovelace_config',
})
msg = await client.receive_json()
@@ -297,3 +298,41 @@ async def test_experimental_ui(hass, hass_ws_client):
assert msg['type'] == wapi.TYPE_RESULT
assert msg['success']
assert msg['result'] == {'hello': 'world'}
async def test_lovelace_ui_not_found(hass, hass_ws_client):
"""Test lovelace_ui command cannot find file."""
await async_setup_component(hass, 'frontend')
client = await hass_ws_client(hass)
with patch('homeassistant.components.frontend.load_yaml',
side_effect=FileNotFoundError):
await client.send_json({
'id': 5,
'type': 'frontend/lovelace_config',
})
msg = await client.receive_json()
assert msg['id'] == 5
assert msg['type'] == wapi.TYPE_RESULT
assert msg['success'] is False
assert msg['error']['code'] == 'file_not_found'
async def test_lovelace_ui_load_err(hass, hass_ws_client):
"""Test lovelace_ui command cannot find file."""
await async_setup_component(hass, 'frontend')
client = await hass_ws_client(hass)
with patch('homeassistant.components.frontend.load_yaml',
side_effect=HomeAssistantError):
await client.send_json({
'id': 5,
'type': 'frontend/lovelace_config',
})
msg = await client.receive_json()
assert msg['id'] == 5
assert msg['type'] == wapi.TYPE_RESULT
assert msg['success'] is False
assert msg['error']['code'] == 'load_error'