Remove HTML support from frontend (#39799)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-09-08 15:42:50 +02:00
1 parent 63aa46369b
commit c6cba5ebc8
4 files changed
+48 -204

No files matched your search

-8
View File
@@ -334,14 +334,6 @@ async def test_missing_themes(hass, hass_ws_client):
assert msg["result"]["themes"] == {}
async def test_extra_urls(mock_http_client_with_urls, mock_onboarded):
"""Test that extra urls are loaded."""
resp = await mock_http_client_with_urls.get("/lovelace?latest")
assert resp.status == 200
text = await resp.text()
assert text.find('href="https://domain.com/my_extra_url.html"') >= 0
async def test_get_panels(hass, hass_ws_client, mock_http_client):
"""Test get_panels command."""
events = async_capture_events(hass, EVENT_PANELS_UPDATED)
@@ -30,52 +30,6 @@ async def test_webcomponent_custom_path_not_found(hass):
assert "nice_url" not in panels
async def test_webcomponent_custom_path(hass, caplog):
"""Test if a web component is found in config panels dir."""
filename = "mock.file"
config = {
"panel_custom": [
{
"name": "todo-mvc",
"webcomponent_path": filename,
"sidebar_title": "Sidebar Title",
"sidebar_icon": "mdi:iconicon",
"url_path": "nice_url",
"config": {"hello": "world"},
},
{"name": "todo-mvc"},
]
}
with patch("os.path.isfile", Mock(return_value=True)):
with patch("os.access", Mock(return_value=True)):
result = await setup.async_setup_component(hass, "panel_custom", config)
assert result
panels = hass.data.get(frontend.DATA_PANELS, [])
assert panels
assert "nice_url" in panels
panel = panels["nice_url"]
assert panel.config == {
"hello": "world",
"_panel_custom": {
"html_url": "/api/panel_custom/todo-mvc",
"name": "todo-mvc",
"embed_iframe": False,
"trust_external": False,
},
}
assert panel.frontend_url_path == "nice_url"
assert panel.sidebar_icon == "mdi:iconicon"
assert panel.sidebar_title == "Sidebar Title"
assert "Got HTML panel with duplicate name todo-mvc. Not registering" in caplog.text
async def test_js_webcomponent(hass):
"""Test if a web component is found in config panels dir."""
config = {
@@ -188,31 +142,6 @@ async def test_latest_and_es5_build(hass):
assert panel.frontend_url_path == "nice_url"
async def test_url_option_conflict(hass):
"""Test config with multiple url options."""
to_try = [
{
"panel_custom": {
"name": "todo-mvc",
"webcomponent_path": "/local/bla.html",
"js_url": "/local/bla.js",
}
},
{
"panel_custom": {
"name": "todo-mvc",
"webcomponent_path": "/local/bla.html",
"module_url": "/local/bla.js",
"js_url": "/local/bla.js",
}
},
]
for config in to_try:
result = await setup.async_setup_component(hass, "panel_custom", config)
assert not result
async def test_url_path_conflict(hass):
"""Test config with overlapping url path."""
assert await setup.async_setup_component(