From 1a4fb908972401784717e5cd55e6ee9bf82c9901 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Mon, 21 Aug 2023 12:03:01 +0200 Subject: [PATCH] Clean off unnecessary logger in Workday (#98741) --- homeassistant/components/workday/__init__.py | 10 +++++----- tests/components/workday/test_binary_sensor.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/workday/__init__.py b/homeassistant/components/workday/__init__.py index d8d31451567..84ed67a36dd 100644 --- a/homeassistant/components/workday/__init__.py +++ b/homeassistant/components/workday/__init__.py @@ -7,7 +7,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryError -from .const import CONF_COUNTRY, CONF_PROVINCE, LOGGER, PLATFORMS +from .const import CONF_COUNTRY, CONF_PROVINCE, PLATFORMS async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: @@ -16,12 +16,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: country: str = entry.options[CONF_COUNTRY] province: str | None = entry.options.get(CONF_PROVINCE) if country and country not in list_supported_countries(): - LOGGER.error("There is no country %s", country) - raise ConfigEntryError("Selected country is not valid") + raise ConfigEntryError(f"Selected country {country} is not valid") if province and province not in list_supported_countries()[country]: - LOGGER.error("There is no subdivision %s in country %s", province, country) - raise ConfigEntryError("Selected province is not valid") + raise ConfigEntryError( + f"Selected province {province} for country {country} is not valid" + ) entry.async_on_unload(entry.add_update_listener(async_update_listener)) diff --git a/tests/components/workday/test_binary_sensor.py b/tests/components/workday/test_binary_sensor.py index a8cea01a864..51280c8d75c 100644 --- a/tests/components/workday/test_binary_sensor.py +++ b/tests/components/workday/test_binary_sensor.py @@ -200,7 +200,7 @@ async def test_setup_faulty_country( state = hass.states.get("binary_sensor.workday_sensor") assert state is None - assert "There is no country" in caplog.text + assert "Selected country ZZ is not valid" in caplog.text async def test_setup_faulty_province( @@ -215,7 +215,7 @@ async def test_setup_faulty_province( state = hass.states.get("binary_sensor.workday_sensor") assert state is None - assert "There is no subdivision" in caplog.text + assert "Selected province ZZ for country DE is not valid" in caplog.text async def test_setup_incorrect_add_remove(