Remove deprecated YAML in Pushover (#80876)

This commit is contained in:
Rami Mosleh 2022-10-25 14:39:38 +03:00 committed by GitHub
parent d50f5e49c8
commit 623abb4325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 36 deletions

View File

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

View File

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

View File

@ -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."
}
}
}

View File

@ -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."
}
}
}

View File

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

View File

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