Clean off unnecessary logger in Workday (#98741)

pull/98755/head
G Johansson 2023-08-21 12:03:01 +02:00 committed by GitHub
parent 180dd3d11a
commit 1a4fb90897
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -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))

View File

@ -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(