mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Fix config error for FTP links, add test (#12294)
This commit is contained in:
parent
b1c0cabe6c
commit
2edebfee0a
@ -22,9 +22,10 @@ CONF_RELATIVE_URL_REGEX = r'\A/'
|
|||||||
DOMAIN = 'weblink'
|
DOMAIN = 'weblink'
|
||||||
|
|
||||||
ENTITIES_SCHEMA = vol.Schema({
|
ENTITIES_SCHEMA = vol.Schema({
|
||||||
|
# pylint: disable=no-value-for-parameter
|
||||||
vol.Required(CONF_URL): vol.Any(
|
vol.Required(CONF_URL): vol.Any(
|
||||||
vol.Match(CONF_RELATIVE_URL_REGEX, msg=CONF_RELATIVE_URL_ERROR_MSG),
|
vol.Match(CONF_RELATIVE_URL_REGEX, msg=CONF_RELATIVE_URL_ERROR_MSG),
|
||||||
cv.url),
|
vol.Url()),
|
||||||
vol.Required(CONF_NAME): cv.string,
|
vol.Required(CONF_NAME): cv.string,
|
||||||
vol.Optional(CONF_ICON): cv.icon,
|
vol.Optional(CONF_ICON): cv.icon,
|
||||||
})
|
})
|
||||||
|
@ -91,6 +91,19 @@ class TestComponentWeblink(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
def test_good_config_ftp_link(self):
|
||||||
|
"""Test if new entity is created."""
|
||||||
|
self.assertTrue(setup_component(self.hass, 'weblink', {
|
||||||
|
'weblink': {
|
||||||
|
'entities': [
|
||||||
|
{
|
||||||
|
weblink.CONF_NAME: 'My FTP URL',
|
||||||
|
weblink.CONF_URL: 'ftp://somehost/'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
def test_entities_get_created(self):
|
def test_entities_get_created(self):
|
||||||
"""Test if new entity is created."""
|
"""Test if new entity is created."""
|
||||||
self.assertTrue(setup_component(self.hass, weblink.DOMAIN, {
|
self.assertTrue(setup_component(self.hass, weblink.DOMAIN, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user