Fix Panel_IFrame - FTP URL not allowed in 0.63 (#12295)

pull/12314/head
Rene Nulsch 2018-02-11 18:19:31 +01:00 committed by Paulus Schoutsen
parent 2edebfee0a
commit 64c5d26a84
2 changed files with 16 additions and 1 deletions

View File

@ -23,13 +23,14 @@ CONF_RELATIVE_URL_REGEX = r'\A/'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
cv.slug: {
# pylint: disable=no-value-for-parameter
vol.Optional(CONF_TITLE): cv.string,
vol.Optional(CONF_ICON): cv.icon,
vol.Required(CONF_URL): vol.Any(
vol.Match(
CONF_RELATIVE_URL_REGEX,
msg=CONF_RELATIVE_URL_ERROR_MSG),
cv.url),
vol.Url()),
}})}, extra=vol.ALLOW_EXTRA)

View File

@ -55,6 +55,11 @@ class TestPanelIframe(unittest.TestCase):
'title': 'Api',
'url': '/api',
},
'ftp': {
'icon': 'mdi:weather',
'title': 'FTP',
'url': 'ftp://some/ftp',
},
},
})
@ -86,3 +91,12 @@ class TestPanelIframe(unittest.TestCase):
'url': '/frontend_es5/panels/ha-panel-iframe-md5md5.html',
'url_path': 'api',
}
assert panels.get('ftp').to_response(self.hass, None) == {
'component_name': 'iframe',
'config': {'url': 'ftp://some/ftp'},
'icon': 'mdi:weather',
'title': 'FTP',
'url': '/frontend_es5/panels/ha-panel-iframe-md5md5.html',
'url_path': 'ftp',
}