2019-02-07 20:07:15 -08:00
|
|
|
"""Test the default_config init."""
|
2024-03-08 14:50:25 +01:00
|
|
|
|
2021-01-01 22:31:56 +01:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
|
2019-02-07 20:07:15 -08:00
|
|
|
import pytest
|
|
|
|
|
|
2024-01-22 20:09:48 +01:00
|
|
|
from homeassistant import bootstrap
|
2023-02-11 08:26:13 +01:00
|
|
|
from homeassistant.core import HomeAssistant
|
2022-07-22 15:11:34 +02:00
|
|
|
from homeassistant.helpers import recorder as recorder_helper
|
2019-12-09 17:42:00 +01:00
|
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
|
|
2023-05-25 13:45:19 +02:00
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
|
2023-05-26 08:13:13 +02:00
|
|
|
def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
2023-05-25 13:45:19 +02:00
|
|
|
"""Stub copying the blueprints to the config folder."""
|
2020-05-03 11:27:19 -07:00
|
|
|
|
2019-02-07 20:07:15 -08:00
|
|
|
|
2020-07-17 15:17:40 -10:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
|
def mock_ssdp():
|
|
|
|
|
"""Mock ssdp."""
|
2022-10-15 20:00:46 +02: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-17 15:17:40 -10:00
|
|
|
yield
|
|
|
|
|
|
|
|
|
|
|
2019-02-07 20:07:15 -08:00
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
|
def recorder_url_mock():
|
|
|
|
|
"""Mock recorder url."""
|
|
|
|
|
with patch("homeassistant.components.recorder.DEFAULT_URL", "sqlite://"):
|
|
|
|
|
yield
|
|
|
|
|
|
|
|
|
|
|
2024-06-06 17:31:08 +02:00
|
|
|
@pytest.mark.usefixtures("mock_bluetooth", "mock_zeroconf")
|
|
|
|
|
async def test_setup(hass: HomeAssistant) -> None:
|
2019-02-07 20:07:15 -08:00
|
|
|
"""Test setup."""
|
2022-07-22 15:11:34 +02:00
|
|
|
recorder_helper.async_initialize_recorder(hass)
|
2024-01-22 20:09:48 +01: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 14:36:49 +03:00
|
|
|
assert await async_setup_component(hass, "default_config", {"foo": "bar"})
|