Move core fundamental components into bootstrap (#105560)

Co-authored-by: Erik <erik@montnemery.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Franck Nijhof 2024-01-22 20:09:48 +01:00 committed by GitHub
parent 31ef034c3f
commit 80207835d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 40 deletions

View file

@ -87,12 +87,21 @@ async def test_async_enable_logging(
async def test_load_hassio(hass: HomeAssistant) -> None:
"""Test that we load Hass.io component."""
"""Test that we load the hassio integration when using Supervisor."""
with patch.dict(os.environ, {}, clear=True):
assert bootstrap._get_domains(hass, {}) == set()
assert "hassio" not in bootstrap._get_domains(hass, {})
with patch.dict(os.environ, {"SUPERVISOR": "1"}):
assert bootstrap._get_domains(hass, {}) == {"hassio"}
assert "hassio" in bootstrap._get_domains(hass, {})
async def test_load_backup(hass: HomeAssistant) -> None:
"""Test that we load the backup integration when not using Supervisor."""
with patch.dict(os.environ, {}, clear=True):
assert "backup" in bootstrap._get_domains(hass, {})
with patch.dict(os.environ, {"SUPERVISOR": "1"}):
assert "backup" not in bootstrap._get_domains(hass, {})
@pytest.mark.parametrize("load_registries", [False])
@ -784,6 +793,7 @@ async def test_setup_recovery_mode_if_no_frontend(
@pytest.mark.parametrize("load_registries", [False])
@patch("homeassistant.bootstrap.DEFAULT_INTEGRATIONS", set())
async def test_empty_integrations_list_is_only_sent_at_the_end_of_bootstrap(
hass: HomeAssistant,
) -> None:
@ -836,7 +846,7 @@ async def test_empty_integrations_list_is_only_sent_at_the_end_of_bootstrap(
assert integrations[0] != {}
assert "an_after_dep" in integrations[0]
assert integrations[-3] != {}
assert integrations[-2] != {}
assert integrations[-1] == {}
assert "normal_integration" in hass.config.components