mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 01:21:51 +02:00
Remove deprecated map integration (#128529)
This commit is contained in:
committed by
GitHub
parent
af41a41046
commit
82e9792b4d
@ -302,7 +302,6 @@ homeassistant.components.lookin.*
|
||||
homeassistant.components.luftdaten.*
|
||||
homeassistant.components.madvr.*
|
||||
homeassistant.components.manual.*
|
||||
homeassistant.components.map.*
|
||||
homeassistant.components.mastodon.*
|
||||
homeassistant.components.matrix.*
|
||||
homeassistant.components.matter.*
|
||||
|
@ -12,7 +12,6 @@
|
||||
"history",
|
||||
"homeassistant_alerts",
|
||||
"logbook",
|
||||
"map",
|
||||
"media_source",
|
||||
"mobile_app",
|
||||
"my",
|
||||
|
@ -1,53 +0,0 @@
|
||||
"""Support for showing device locations."""
|
||||
|
||||
from homeassistant.components import onboarding
|
||||
from homeassistant.components.lovelace import _create_map_dashboard
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.storage import Store
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "map"
|
||||
|
||||
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
||||
|
||||
STORAGE_KEY = DOMAIN
|
||||
STORAGE_VERSION_MAJOR = 1
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Create a map panel."""
|
||||
|
||||
if DOMAIN in config:
|
||||
async_create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_yaml_{DOMAIN}",
|
||||
breaks_in_ha_version="2024.10.0",
|
||||
is_fixable=False,
|
||||
is_persistent=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_yaml",
|
||||
translation_placeholders={
|
||||
"domain": DOMAIN,
|
||||
"integration_title": "map",
|
||||
},
|
||||
)
|
||||
|
||||
store: Store[dict[str, bool]] = Store(
|
||||
hass,
|
||||
STORAGE_VERSION_MAJOR,
|
||||
STORAGE_KEY,
|
||||
)
|
||||
data = await store.async_load()
|
||||
if data:
|
||||
return True
|
||||
|
||||
if onboarding.async_is_onboarded(hass):
|
||||
await _create_map_dashboard(hass)
|
||||
|
||||
await store.async_save({"migrated": True})
|
||||
|
||||
return True
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"domain": "map",
|
||||
"name": "Map",
|
||||
"codeowners": [],
|
||||
"dependencies": ["frontend", "lovelace"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/map",
|
||||
"integration_type": "system",
|
||||
"quality_scale": "internal"
|
||||
}
|
10
mypy.ini
10
mypy.ini
@ -2775,16 +2775,6 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.map.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.mastodon.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
@ -88,7 +88,6 @@ NO_IOT_CLASS = [
|
||||
"logbook",
|
||||
"logger",
|
||||
"lovelace",
|
||||
"map",
|
||||
"media_source",
|
||||
"my",
|
||||
"onboarding",
|
||||
|
@ -1 +0,0 @@
|
||||
"""Tests for Map."""
|
@ -1,118 +0,0 @@
|
||||
"""Test the Map initialization."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.map import DOMAIN
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockModule, mock_integration
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_onboarding_not_done() -> Generator[MagicMock]:
|
||||
"""Mock that Home Assistant is currently onboarding."""
|
||||
with patch(
|
||||
"homeassistant.components.onboarding.async_is_onboarded",
|
||||
return_value=False,
|
||||
) as mock_onboarding:
|
||||
yield mock_onboarding
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_onboarding_done() -> Generator[MagicMock]:
|
||||
"""Mock that Home Assistant is currently onboarding."""
|
||||
with patch(
|
||||
"homeassistant.components.onboarding.async_is_onboarded",
|
||||
return_value=True,
|
||||
) as mock_onboarding:
|
||||
yield mock_onboarding
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_create_map_dashboard() -> Generator[MagicMock]:
|
||||
"""Mock the create map dashboard function."""
|
||||
with patch(
|
||||
"homeassistant.components.map._create_map_dashboard",
|
||||
) as mock_create_map_dashboard:
|
||||
yield mock_create_map_dashboard
|
||||
|
||||
|
||||
async def test_create_dashboards_when_onboarded(
|
||||
hass: HomeAssistant,
|
||||
hass_storage: dict[str, Any],
|
||||
mock_onboarding_done,
|
||||
mock_create_map_dashboard,
|
||||
) -> None:
|
||||
"""Test we create map dashboard when onboarded."""
|
||||
# Mock the lovelace integration to prevent it from creating a map dashboard
|
||||
mock_integration(hass, MockModule("lovelace"))
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
mock_create_map_dashboard.assert_called_once()
|
||||
assert hass_storage[DOMAIN]["data"] == {"migrated": True}
|
||||
|
||||
|
||||
async def test_create_dashboards_once_when_onboarded(
|
||||
hass: HomeAssistant,
|
||||
hass_storage: dict[str, Any],
|
||||
mock_onboarding_done,
|
||||
mock_create_map_dashboard,
|
||||
) -> None:
|
||||
"""Test we create map dashboard once when onboarded."""
|
||||
hass_storage[DOMAIN] = {
|
||||
"version": 1,
|
||||
"minor_version": 1,
|
||||
"key": "map",
|
||||
"data": {"migrated": True},
|
||||
}
|
||||
|
||||
# Mock the lovelace integration to prevent it from creating a map dashboard
|
||||
mock_integration(hass, MockModule("lovelace"))
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
mock_create_map_dashboard.assert_not_called()
|
||||
assert hass_storage[DOMAIN]["data"] == {"migrated": True}
|
||||
|
||||
|
||||
async def test_create_dashboards_when_not_onboarded(
|
||||
hass: HomeAssistant,
|
||||
hass_storage: dict[str, Any],
|
||||
mock_onboarding_not_done,
|
||||
mock_create_map_dashboard,
|
||||
) -> None:
|
||||
"""Test we do not create map dashboard when not onboarded."""
|
||||
# Mock the lovelace integration to prevent it from creating a map dashboard
|
||||
mock_integration(hass, MockModule("lovelace"))
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
mock_create_map_dashboard.assert_not_called()
|
||||
assert hass_storage[DOMAIN]["data"] == {"migrated": True}
|
||||
|
||||
|
||||
async def test_create_issue_when_not_manually_configured(
|
||||
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
||||
) -> None:
|
||||
"""Test creating issue registry issues."""
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
assert not issue_registry.async_get_issue(
|
||||
HOMEASSISTANT_DOMAIN, "deprecated_yaml_map"
|
||||
)
|
||||
|
||||
|
||||
async def test_create_issue_when_manually_configured(
|
||||
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
||||
) -> None:
|
||||
"""Test creating issue registry issues."""
|
||||
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
|
||||
assert issue_registry.async_get_issue(HOMEASSISTANT_DOMAIN, "deprecated_yaml_map")
|
Reference in New Issue
Block a user