From 623abb4325e01f8a70b390dd8eae784f4c00dbf4 Mon Sep 17 00:00:00 2001 From: Rami Mosleh Date: Tue, 25 Oct 2022 14:39:38 +0300 Subject: [PATCH] Remove deprecated YAML in Pushover (#80876) --- homeassistant/components/pushover/config_flow.py | 4 ---- homeassistant/components/pushover/notify.py | 14 +++----------- homeassistant/components/pushover/strings.json | 6 +++--- .../components/pushover/translations/en.json | 6 +++--- tests/components/pushover/test_config_flow.py | 13 ------------- tests/components/pushover/test_init.py | 4 ++-- 6 files changed, 11 insertions(+), 36 deletions(-) diff --git a/homeassistant/components/pushover/config_flow.py b/homeassistant/components/pushover/config_flow.py index ddb61d4bbc3a..5119d91a174a 100644 --- a/homeassistant/components/pushover/config_flow.py +++ b/homeassistant/components/pushover/config_flow.py @@ -44,10 +44,6 @@ class PushBulletConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): _reauth_entry: config_entries.ConfigEntry | None - async def async_step_import(self, import_config: dict[str, Any]) -> FlowResult: - """Handle import from config.""" - return await self.async_step_user(import_config) - async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> FlowResult: """Perform reauth upon an API authentication error.""" self._reauth_entry = self.hass.config_entries.async_get_entry( diff --git a/homeassistant/components/pushover/notify.py b/homeassistant/components/pushover/notify.py index bcf472641088..fa4b35da2faa 100644 --- a/homeassistant/components/pushover/notify.py +++ b/homeassistant/components/pushover/notify.py @@ -15,7 +15,6 @@ from homeassistant.components.notify import ( PLATFORM_SCHEMA, BaseNotificationService, ) -from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import CONF_API_KEY from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError @@ -57,18 +56,11 @@ async def async_get_service( async_create_issue( hass, DOMAIN, - "deprecated_yaml", + "removed_yaml", breaks_in_ha_version="2022.11.0", is_fixable=False, severity=IssueSeverity.WARNING, - translation_key="deprecated_yaml", - ) - hass.async_create_task( - hass.config_entries.flow.async_init( - DOMAIN, - context={"source": SOURCE_IMPORT}, - data=config, - ) + translation_key="removed_yaml", ) return None @@ -89,7 +81,7 @@ class PushoverNotificationService(BaseNotificationService): self._user_key = user_key self.pushover = pushover - def send_message(self, message: str = "", **kwargs: dict[str, Any]) -> None: + def send_message(self, message: str = "", **kwargs: Any) -> None: """Send a message to a user.""" # Extract params from data dict diff --git a/homeassistant/components/pushover/strings.json b/homeassistant/components/pushover/strings.json index c309a1ec01fc..3c2ab66bf399 100644 --- a/homeassistant/components/pushover/strings.json +++ b/homeassistant/components/pushover/strings.json @@ -26,9 +26,9 @@ } }, "issues": { - "deprecated_yaml": { - "title": "The Pushover YAML configuration is being removed", - "description": "Configuring Pushover using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Pushover YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." + "removed_yaml": { + "title": "The Pushover YAML configuration has been removed", + "description": "Configuring Pushover using YAML has been removed.\n\nYour existing YAML configuration is not used by Home Assistant.\n\nRemove the Pushover YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." } } } diff --git a/homeassistant/components/pushover/translations/en.json b/homeassistant/components/pushover/translations/en.json index 33826000dc3a..926b58726f05 100644 --- a/homeassistant/components/pushover/translations/en.json +++ b/homeassistant/components/pushover/translations/en.json @@ -26,9 +26,9 @@ } }, "issues": { - "deprecated_yaml": { - "description": "Configuring Pushover using YAML is being removed.\n\nYour existing YAML configuration has been imported into the UI automatically.\n\nRemove the Pushover YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue.", - "title": "The Pushover YAML configuration is being removed" + "removed_yaml": { + "title": "The Pushover YAML configuration has been removed", + "description": "Configuring Pushover using YAML has been removed.\n\nYour existing YAML configuration is not used by Home Assistant.\n\nRemove the Pushover YAML configuration from your configuration.yaml file and restart Home Assistant to fix this issue." } } } \ No newline at end of file diff --git a/tests/components/pushover/test_config_flow.py b/tests/components/pushover/test_config_flow.py index 1e919167c6a1..642f1b1b1bba 100644 --- a/tests/components/pushover/test_config_flow.py +++ b/tests/components/pushover/test_config_flow.py @@ -140,19 +140,6 @@ async def test_flow_conn_err(hass: HomeAssistant, mock_pushover: MagicMock) -> N assert result["errors"] == {"base": "cannot_connect"} -async def test_import(hass: HomeAssistant) -> None: - """Test user initialized flow with unreachable server.""" - result = await hass.config_entries.flow.async_init( - DOMAIN, - context={"source": config_entries.SOURCE_IMPORT}, - data=MOCK_CONFIG, - ) - - assert result["type"] == FlowResultType.CREATE_ENTRY - assert result["title"] == "Pushover" - assert result["data"] == MOCK_CONFIG - - async def test_reauth_success(hass: HomeAssistant) -> None: """Test we can reauth.""" entry = MockConfigEntry( diff --git a/tests/components/pushover/test_init.py b/tests/components/pushover/test_init.py index ff85e88f07e8..635aec520b52 100644 --- a/tests/components/pushover/test_init.py +++ b/tests/components/pushover/test_init.py @@ -52,10 +52,10 @@ async def test_setup( }, ) await hass.async_block_till_done() - assert hass.config_entries.async_entries(DOMAIN) + assert not hass.config_entries.async_entries(DOMAIN) issues = await get_repairs(hass, hass_ws_client) assert len(issues) == 1 - assert issues[0]["issue_id"] == "deprecated_yaml" + assert issues[0]["issue_id"] == "removed_yaml" async def test_async_setup_entry_success(