Skip to content

Commit

Permalink
Remove deprecated YAML in Pushover (home-assistant#80876)
Browse files Browse the repository at this point in the history
  • Loading branch information
engrbm87 authored Oct 25, 2022
1 parent d50f5e4 commit 623abb4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
4 changes: 0 additions & 4 deletions homeassistant/components/pushover/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 3 additions & 11 deletions homeassistant/components/pushover/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
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
Expand Down Expand Up @@ -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

Expand All @@ -89,7 +81,7 @@ def __init__(
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
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/pushover/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
}
6 changes: 3 additions & 3 deletions homeassistant/components/pushover/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
}
13 changes: 0 additions & 13 deletions tests/components/pushover/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/components/pushover/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 623abb4

Please sign in to comment.