mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00

* add cover unit tests * Add unit test for SwitchBot cover * fix: use mock_restore_cache to mock the last state * modify unit tests * modify scripts as suggest * improve readability * adjust patch target per review comments * adjust patch target per review comments --------- Co-authored-by: J. Nick Koston <nick@koston.org>
28 lines
750 B
Python
28 lines
750 B
Python
"""Define fixtures available for all tests."""
|
|
|
|
import pytest
|
|
|
|
from homeassistant.components.switchbot.const import DOMAIN
|
|
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_SENSOR_TYPE
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def mock_bluetooth(enable_bluetooth: None) -> None:
|
|
"""Auto mock bluetooth."""
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_entry_factory():
|
|
"""Fixture to create a MockConfigEntry with a customizable sensor type."""
|
|
return lambda sensor_type="curtain": MockConfigEntry(
|
|
domain=DOMAIN,
|
|
data={
|
|
CONF_ADDRESS: "aa:bb:cc:dd:ee:ff",
|
|
CONF_NAME: "test-name",
|
|
CONF_SENSOR_TYPE: sensor_type,
|
|
},
|
|
unique_id="aabbccddeeff",
|
|
)
|