mirror of
https://github.com/home-assistant/core.git
synced 2025-05-12 01:49:16 +00:00
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""Define fixtures available for all tests."""
|
|
|
|
import pytest
|
|
|
|
from homeassistant.components.switchbot.const import (
|
|
CONF_ENCRYPTION_KEY,
|
|
CONF_KEY_ID,
|
|
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",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_entry_encrypted_factory():
|
|
"""Fixture to create a MockConfigEntry with an encryption key and a customizable sensor type."""
|
|
return lambda sensor_type="lock": MockConfigEntry(
|
|
domain=DOMAIN,
|
|
data={
|
|
CONF_ADDRESS: "aa:bb:cc:dd:ee:ff",
|
|
CONF_NAME: "test-name",
|
|
CONF_SENSOR_TYPE: sensor_type,
|
|
CONF_KEY_ID: "ff",
|
|
CONF_ENCRYPTION_KEY: "ffffffffffffffffffffffffffffffff",
|
|
},
|
|
unique_id="aabbccddeeff",
|
|
)
|