From 73aac331a5bb9bc7afd8339d81a96b6802e7f7bd Mon Sep 17 00:00:00 2001 From: Rene Nulsch Date: Sun, 11 Feb 2018 10:25:56 +0100 Subject: [PATCH] Fix config error for FTP links, add test --- homeassistant/components/weblink.py | 3 ++- tests/components/test_weblink.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/weblink.py b/homeassistant/components/weblink.py index a20b0fc9b0c4a3..cd87bd838fafdf 100644 --- a/homeassistant/components/weblink.py +++ b/homeassistant/components/weblink.py @@ -22,9 +22,10 @@ DOMAIN = 'weblink' ENTITIES_SCHEMA = vol.Schema({ + # pylint: disable=no-value-for-parameter vol.Required(CONF_URL): vol.Any( vol.Match(CONF_RELATIVE_URL_REGEX, msg=CONF_RELATIVE_URL_ERROR_MSG), - cv.url), + vol.Url()), vol.Required(CONF_NAME): cv.string, vol.Optional(CONF_ICON): cv.icon, }) diff --git a/tests/components/test_weblink.py b/tests/components/test_weblink.py index 249e81d37af7b7..f35398e034c08c 100644 --- a/tests/components/test_weblink.py +++ b/tests/components/test_weblink.py @@ -91,6 +91,19 @@ def test_good_config_path_directory(self): } })) + 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): """Test if new entity is created.""" self.assertTrue(setup_component(self.hass, weblink.DOMAIN, {