mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Rename the safe_mode integration to recovery_mode (#102581)
* Rename safe mode integration to recovery mode * Update code
This commit is contained in:
parent
6372bc3aaa
commit
b953f2998c
@ -96,8 +96,8 @@ components: &components
|
||||
- homeassistant/components/persistent_notification/**
|
||||
- homeassistant/components/person/**
|
||||
- homeassistant/components/recorder/**
|
||||
- homeassistant/components/recovery_mode/**
|
||||
- homeassistant/components/repairs/**
|
||||
- homeassistant/components/safe_mode/**
|
||||
- homeassistant/components/script/**
|
||||
- homeassistant/components/shopping_list/**
|
||||
- homeassistant/components/ssdp/**
|
||||
|
@ -1035,6 +1035,8 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/recollect_waste/ @bachya
|
||||
/homeassistant/components/recorder/ @home-assistant/core
|
||||
/tests/components/recorder/ @home-assistant/core
|
||||
/homeassistant/components/recovery_mode/ @home-assistant/core
|
||||
/tests/components/recovery_mode/ @home-assistant/core
|
||||
/homeassistant/components/rejseplanen/ @DarkFox
|
||||
/homeassistant/components/remote/ @home-assistant/core
|
||||
/tests/components/remote/ @home-assistant/core
|
||||
@ -1085,8 +1087,6 @@ build.json @home-assistant/supervisor
|
||||
/tests/components/rympro/ @OnFreund @elad-bar @maorcc
|
||||
/homeassistant/components/sabnzbd/ @shaiu
|
||||
/tests/components/sabnzbd/ @shaiu
|
||||
/homeassistant/components/safe_mode/ @home-assistant/core
|
||||
/tests/components/safe_mode/ @home-assistant/core
|
||||
/homeassistant/components/saj/ @fredericvl
|
||||
/homeassistant/components/samsungtv/ @chemelli74 @epenet
|
||||
/tests/components/samsungtv/ @chemelli74 @epenet
|
||||
|
@ -194,7 +194,7 @@ async def async_setup_hass(
|
||||
http_conf = (await http.async_get_last_config(hass)) or {}
|
||||
|
||||
await async_from_config_dict(
|
||||
{"safe_mode": {}, "http": http_conf},
|
||||
{"recovery_mode": {}, "http": http_conf},
|
||||
hass,
|
||||
)
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
"""The Safe Mode integration."""
|
||||
"""The Recovery Mode integration."""
|
||||
from homeassistant.components import persistent_notification
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "safe_mode"
|
||||
DOMAIN = "recovery_mode"
|
||||
|
||||
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the Safe Mode component."""
|
||||
"""Set up the Recovery Mode component."""
|
||||
persistent_notification.async_create(
|
||||
hass,
|
||||
(
|
||||
"Home Assistant is running in safe mode. Check [the error"
|
||||
"Home Assistant is running in recovery mode. Check [the error"
|
||||
" log](/config/logs) to see what went wrong."
|
||||
),
|
||||
"Safe Mode",
|
||||
"Recovery Mode",
|
||||
)
|
||||
return True
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"domain": "safe_mode",
|
||||
"name": "Safe Mode",
|
||||
"domain": "recovery_mode",
|
||||
"name": "Recovery Mode",
|
||||
"codeowners": ["@home-assistant/core"],
|
||||
"config_flow": false,
|
||||
"dependencies": ["frontend", "persistent_notification", "cloud"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/safe_mode",
|
||||
"documentation": "https://www.home-assistant.io/integrations/recovery_mode",
|
||||
"integration_type": "system",
|
||||
"quality_scale": "internal"
|
||||
}
|
@ -98,8 +98,8 @@ NO_IOT_CLASS = [
|
||||
"proxy",
|
||||
"python_script",
|
||||
"raspberry_pi",
|
||||
"recovery_mode",
|
||||
"repairs",
|
||||
"safe_mode",
|
||||
"schedule",
|
||||
"script",
|
||||
"search",
|
||||
|
1
tests/components/recovery_mode/__init__.py
Normal file
1
tests/components/recovery_mode/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""Tests for the Recovery Mode integration."""
|
@ -1,4 +1,4 @@
|
||||
"""Tests for safe mode integration."""
|
||||
"""Tests for the Recovery Mode integration."""
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@ -6,8 +6,8 @@ from tests.common import async_get_persistent_notifications
|
||||
|
||||
|
||||
async def test_works(hass: HomeAssistant) -> None:
|
||||
"""Test safe mode works."""
|
||||
assert await async_setup_component(hass, "safe_mode", {})
|
||||
"""Test Recovery Mode works."""
|
||||
assert await async_setup_component(hass, "recovery_mode", {})
|
||||
await hass.async_block_till_done()
|
||||
notifications = async_get_persistent_notifications(hass)
|
||||
assert len(notifications) == 1
|
@ -1 +0,0 @@
|
||||
"""Tests for the Safe Mode integration."""
|
@ -103,7 +103,7 @@ async def test_empty_setup(hass: HomeAssistant) -> None:
|
||||
assert domain in hass.config.components, domain
|
||||
|
||||
|
||||
async def test_core_failure_loads_safe_mode(
|
||||
async def test_core_failure_loads_recovery_mode(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Test failing core setup aborts further setup."""
|
||||
@ -495,7 +495,7 @@ async def test_setup_hass(
|
||||
assert "Waiting on integrations to complete setup" not in caplog.text
|
||||
|
||||
assert "browser" in hass.config.components
|
||||
assert "safe_mode" not in hass.config.components
|
||||
assert "recovery_mode" not in hass.config.components
|
||||
|
||||
assert len(mock_enable_logging.mock_calls) == 1
|
||||
assert mock_enable_logging.mock_calls[0][1] == (
|
||||
@ -578,7 +578,7 @@ async def test_setup_hass_invalid_yaml(
|
||||
),
|
||||
)
|
||||
|
||||
assert "safe_mode" in hass.config.components
|
||||
assert "recovery_mode" in hass.config.components
|
||||
assert len(mock_mount_local_lib_path.mock_calls) == 0
|
||||
|
||||
|
||||
@ -609,7 +609,7 @@ async def test_setup_hass_config_dir_nonexistent(
|
||||
)
|
||||
|
||||
|
||||
async def test_setup_hass_safe_mode(
|
||||
async def test_setup_hass_recovery_mode(
|
||||
mock_enable_logging: Mock,
|
||||
mock_is_virtual_env: Mock,
|
||||
mock_mount_local_lib_path: AsyncMock,
|
||||
@ -634,7 +634,7 @@ async def test_setup_hass_safe_mode(
|
||||
),
|
||||
)
|
||||
|
||||
assert "safe_mode" in hass.config.components
|
||||
assert "recovery_mode" in hass.config.components
|
||||
assert len(mock_mount_local_lib_path.mock_calls) == 0
|
||||
|
||||
# Validate we didn't try to set up config entry.
|
||||
@ -665,7 +665,7 @@ async def test_setup_hass_invalid_core_config(
|
||||
),
|
||||
)
|
||||
|
||||
assert "safe_mode" in hass.config.components
|
||||
assert "recovery_mode" in hass.config.components
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -681,7 +681,7 @@ async def test_setup_hass_invalid_core_config(
|
||||
}
|
||||
],
|
||||
)
|
||||
async def test_setup_safe_mode_if_no_frontend(
|
||||
async def test_setup_recovery_mode_if_no_frontend(
|
||||
mock_hass_config: None,
|
||||
mock_enable_logging: Mock,
|
||||
mock_is_virtual_env: Mock,
|
||||
@ -690,7 +690,7 @@ async def test_setup_safe_mode_if_no_frontend(
|
||||
mock_process_ha_config_upgrade: Mock,
|
||||
event_loop: asyncio.AbstractEventLoop,
|
||||
) -> None:
|
||||
"""Test we setup safe mode if frontend didn't load."""
|
||||
"""Test we setup recovery mode if frontend didn't load."""
|
||||
verbose = Mock()
|
||||
log_rotate_days = Mock()
|
||||
log_file = Mock()
|
||||
@ -708,7 +708,7 @@ async def test_setup_safe_mode_if_no_frontend(
|
||||
),
|
||||
)
|
||||
|
||||
assert "safe_mode" in hass.config.components
|
||||
assert "recovery_mode" in hass.config.components
|
||||
assert hass.config.config_dir == get_test_config_dir()
|
||||
assert hass.config.skip_pip
|
||||
assert hass.config.internal_url == "http://192.168.1.100:8123"
|
||||
|
Loading…
x
Reference in New Issue
Block a user