hass-core/tests/components/default_config/test_init.py
J. Nick Koston 7b016063ca
Refactor zeroconf setup to be async (#39955)
* Refactor zeroconf setup to be async

Most of the setup was calling back to async because
we were setting up listeners.  Since we only need
to jump into the executor to create the zeroconf
instance, its much faster to setup in async.

In testing this cut the setup time in half
or better.

* partial revert to after_deps
2020-09-13 18:06:19 -05:00

32 lines
778 B
Python

"""Test the default_config init."""
import pytest
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
@pytest.fixture(autouse=True)
def mock_ssdp():
"""Mock ssdp."""
with patch("homeassistant.components.ssdp.Scanner.async_scan"):
yield
@pytest.fixture(autouse=True)
def mock_updater():
"""Mock updater."""
with patch("homeassistant.components.updater.get_newest_version"):
yield
@pytest.fixture(autouse=True)
def recorder_url_mock():
"""Mock recorder url."""
with patch("homeassistant.components.recorder.DEFAULT_URL", "sqlite://"):
yield
async def test_setup(hass, mock_zeroconf):
"""Test setup."""
assert await async_setup_component(hass, "default_config", {"foo": "bar"})