core/tests/components/abode/common.py

26 lines
854 B
Python
Raw Normal View History

"""Common methods used across tests for Abode."""
2021-01-01 21:31:56 +00:00
from unittest.mock import patch
from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry
async def setup_platform(hass, platform):
"""Set up the Abode platform."""
mock_entry = MockConfigEntry(
domain=ABODE_DOMAIN,
data={CONF_USERNAME: "user@email.com", CONF_PASSWORD: "password"},
)
mock_entry.add_to_hass(hass)
with patch("homeassistant.components.abode.PLATFORMS", [platform]), patch(
"abodepy.event_controller.sio"
), patch("abodepy.utils.save_cache"):
assert await async_setup_component(hass, ABODE_DOMAIN, {})
await hass.async_block_till_done()
return mock_entry