hass-core/tests/components/abode/common.py
shred86 d36259f067
Add Abode tests ()
* Add tests for several devices

* Update coveragerc

* Code review changes and minor clean up

* More code review changes

* Update manifest and minor test updates

* Add test for locks and covers

* Add tests for switch on and off

* Add more complete test for alarms

* Fix for camera test

* Patch abodepy.mode for tests

* Add test for unknown alarm state and minor cleanup

* Update to make tests more robust

* More specific tests

* Update quality scale to silver

* Remove integration quality scale
2020-03-16 03:05:10 +01:00

25 lines
860 B
Python

"""Common methods used across tests for Abode."""
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.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