From f61d605d6d550015b637939031496e61bd74b64b Mon Sep 17 00:00:00 2001 From: Shai Ungar Date: Fri, 6 Jan 2023 01:53:30 +0200 Subject: [PATCH] Remove redundant CONF_PATH from sabnzbd config flow (#85214) remove redundant CONF_PATH from sabnzbd config flow --- homeassistant/components/sabnzbd/__init__.py | 2 -- homeassistant/components/sabnzbd/config_flow.py | 2 -- homeassistant/components/sabnzbd/sab.py | 4 +--- homeassistant/components/sabnzbd/strings.json | 3 +-- tests/components/sabnzbd/test_config_flow.py | 5 ----- 5 files changed, 2 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/sabnzbd/__init__.py b/homeassistant/components/sabnzbd/__init__.py index fe9a64f3d6b..fb3b4e46533 100644 --- a/homeassistant/components/sabnzbd/__init__.py +++ b/homeassistant/components/sabnzbd/__init__.py @@ -12,7 +12,6 @@ from homeassistant.const import ( CONF_API_KEY, CONF_HOST, CONF_NAME, - CONF_PATH, CONF_PORT, CONF_SENSORS, CONF_SSL, @@ -80,7 +79,6 @@ CONFIG_SCHEMA = vol.Schema( { vol.Required(CONF_API_KEY): str, vol.Optional(CONF_NAME, default=DEFAULT_NAME): str, - vol.Optional(CONF_PATH): str, vol.Optional(CONF_HOST, default=DEFAULT_HOST): cv.string, vol.Optional(CONF_PORT, default=DEFAULT_PORT): cv.port, vol.Optional(CONF_SENSORS): vol.All( diff --git a/homeassistant/components/sabnzbd/config_flow.py b/homeassistant/components/sabnzbd/config_flow.py index 7930363b2ac..073f4a08f76 100644 --- a/homeassistant/components/sabnzbd/config_flow.py +++ b/homeassistant/components/sabnzbd/config_flow.py @@ -11,7 +11,6 @@ from homeassistant.const import ( CONF_API_KEY, CONF_HOST, CONF_NAME, - CONF_PATH, CONF_PORT, CONF_SSL, CONF_URL, @@ -28,7 +27,6 @@ USER_SCHEMA = vol.Schema( vol.Required(CONF_API_KEY): str, vol.Optional(CONF_NAME, default=DEFAULT_NAME): str, vol.Required(CONF_URL): str, - vol.Optional(CONF_PATH): str, } ) diff --git a/homeassistant/components/sabnzbd/sab.py b/homeassistant/components/sabnzbd/sab.py index ab3575c7092..af70e4b8afc 100644 --- a/homeassistant/components/sabnzbd/sab.py +++ b/homeassistant/components/sabnzbd/sab.py @@ -1,21 +1,19 @@ """Support for the Sabnzbd service.""" from pysabnzbd import SabnzbdApi, SabnzbdApiException -from homeassistant.const import CONF_API_KEY, CONF_PATH, CONF_URL +from homeassistant.const import CONF_API_KEY, CONF_URL from homeassistant.core import _LOGGER, HomeAssistant from homeassistant.helpers.aiohttp_client import async_get_clientsession async def get_client(hass: HomeAssistant, data): """Get Sabnzbd client.""" - web_root = data.get(CONF_PATH) api_key = data[CONF_API_KEY] url = data[CONF_URL] sab_api = SabnzbdApi( url, api_key, - web_root=web_root, session=async_get_clientsession(hass, False), ) try: diff --git a/homeassistant/components/sabnzbd/strings.json b/homeassistant/components/sabnzbd/strings.json index 9de5e08230c..501e0d33faf 100644 --- a/homeassistant/components/sabnzbd/strings.json +++ b/homeassistant/components/sabnzbd/strings.json @@ -5,8 +5,7 @@ "data": { "api_key": "[%key:common::config_flow::data::api_key%]", "name": "[%key:common::config_flow::data::name%]", - "url": "[%key:common::config_flow::data::url%]", - "path": "[%key:common::config_flow::data::path%]" + "url": "[%key:common::config_flow::data::url%]" } } }, diff --git a/tests/components/sabnzbd/test_config_flow.py b/tests/components/sabnzbd/test_config_flow.py index 2c5e9e1ffc9..f48f788b348 100644 --- a/tests/components/sabnzbd/test_config_flow.py +++ b/tests/components/sabnzbd/test_config_flow.py @@ -10,7 +10,6 @@ from homeassistant.const import ( CONF_API_KEY, CONF_HOST, CONF_NAME, - CONF_PATH, CONF_PORT, CONF_SSL, CONF_URL, @@ -21,7 +20,6 @@ VALID_CONFIG = { CONF_NAME: "Sabnzbd", CONF_API_KEY: "edc3eee7330e4fdda04489e3fbc283d0", CONF_URL: "http://localhost:8080", - CONF_PATH: "", } VALID_CONFIG_OLD = { @@ -29,7 +27,6 @@ VALID_CONFIG_OLD = { CONF_API_KEY: "edc3eee7330e4fdda04489e3fbc283d0", CONF_HOST: "localhost", CONF_PORT: 8080, - CONF_PATH: "", CONF_SSL: False, } @@ -60,7 +57,6 @@ async def test_create_entry(hass): assert result2["data"] == { CONF_API_KEY: "edc3eee7330e4fdda04489e3fbc283d0", CONF_NAME: "Sabnzbd", - CONF_PATH: "", CONF_URL: "http://localhost:8080", } assert len(mock_setup_entry.mock_calls) == 1 @@ -99,5 +95,4 @@ async def test_import_flow(hass) -> None: assert result["data"][CONF_API_KEY] == "edc3eee7330e4fdda04489e3fbc283d0" assert result["data"][CONF_HOST] == "localhost" assert result["data"][CONF_PORT] == 8080 - assert result["data"][CONF_PATH] == "" assert result["data"][CONF_SSL] is False