Files
homeassistant-core/tests/components/default_config/test_init.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.5 KiB
Python
Raw Normal View History

2019-02-07 20:07:15 -08:00
"""Test the default_config init."""
2021-01-01 22:31:56 +01:00
from unittest.mock import patch
2019-02-07 20:07:15 -08:00
import pytest
from homeassistant import bootstrap
from homeassistant.core import HomeAssistant
from homeassistant.helpers import recorder as recorder_helper
from homeassistant.setup import async_setup_component
2023-05-25 13:45:19 +02:00
@pytest.fixture(autouse=True, name="stub_blueprint_populate")
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
@pytest.fixture(autouse=True)
def mock_ssdp():
"""Mock ssdp."""
with (
patch("homeassistant.components.ssdp.Scanner.async_scan"),
patch("homeassistant.components.ssdp.Server.async_start"),
patch("homeassistant.components.ssdp.Server.async_stop"),
):
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
@pytest.mark.usefixtures("mock_bluetooth", "mock_zeroconf")
async def test_setup(hass: HomeAssistant) -> None:
2019-02-07 20:07:15 -08:00
"""Test setup."""
recorder_helper.async_initialize_recorder(hass)
# 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"})
assert await async_setup_component(hass, "default_config", {"foo": "bar"})