2019-02-08 04:07:15 +00:00
|
|
|
"""Test the default_config init."""
|
2024-03-08 13:50:25 +00:00
|
|
|
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
2019-02-08 04:07:15 +00:00
|
|
|
import pytest
|
|
|
|
|
2024-01-22 19:09:48 +00:00
|
|
|
from homeassistant import bootstrap
|
2023-02-11 07:26:13 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2022-07-22 13:11:34 +00:00
|
|
|
from homeassistant.helpers import recorder as recorder_helper
|
2019-12-09 16:42:00 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
|
2023-05-25 11:45:19 +00:00
|
|
|
|
|
|
|
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
2023-05-26 06:13:13 +00:00
|
|
|
def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
2023-05-25 11:45:19 +00:00
|
|
|
"""Stub copying the blueprints to the config folder."""
|
2020-05-03 18:27:19 +00:00
|
|
|
|
2019-02-08 04:07:15 +00:00
|
|
|
|
2020-07-18 01:17:40 +00:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def mock_ssdp():
|
|
|
|
"""Mock ssdp."""
|
2024-03-25 23:02:16 +00:00
|
|
|
with (
|
|
|
|
patch("homeassistant.components.ssdp.Scanner.async_scan"),
|
|
|
|
patch("homeassistant.components.ssdp.Server.async_start"),
|
|
|
|
patch("homeassistant.components.ssdp.Server.async_stop"),
|
|
|
|
):
|
2020-07-18 01:17:40 +00:00
|
|
|
yield
|
|
|
|
|
|
|
|
|
2019-02-08 04:07:15 +00:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
def recorder_url_mock():
|
|
|
|
"""Mock recorder url."""
|
2019-07-31 19:25:30 +00:00
|
|
|
with patch("homeassistant.components.recorder.DEFAULT_URL", "sqlite://"):
|
2019-02-08 04:07:15 +00:00
|
|
|
yield
|
|
|
|
|
|
|
|
|
2024-06-06 15:31:08 +00:00
|
|
|
@pytest.mark.usefixtures("mock_bluetooth", "mock_zeroconf")
|
|
|
|
async def test_setup(hass: HomeAssistant) -> None:
|
2019-02-08 04:07:15 +00:00
|
|
|
"""Test setup."""
|
2022-07-22 13:11:34 +00:00
|
|
|
recorder_helper.async_initialize_recorder(hass)
|
2024-01-22 19:09:48 +00:00
|
|
|
# default_config needs the homeassistant integration, assert it will be
|
|
|
|
# automatically setup by bootstrap and set it up manually for this test
|
|
|
|
assert "homeassistant" in bootstrap.CORE_INTEGRATIONS
|
|
|
|
assert await async_setup_component(hass, "homeassistant", {"foo": "bar"})
|
|
|
|
|
2020-04-06 11:36:49 +00:00
|
|
|
assert await async_setup_component(hass, "default_config", {"foo": "bar"})
|