Add Abode tests (#32562)
* 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
This commit is contained in:
1 parent
d62bb9ed47
commit
d36259f067
18 files changed
+1904
-9
No files matched your search
@@ -0,0 +1,40 @@
|
||||
"""Tests for the Abode camera device."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode.const import DOMAIN as ABODE_DOMAIN
|
||||
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_IDLE
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
|
||||
async def test_entity_registry(hass):
|
||||
"""Tests that the devices are registered in the entity registry."""
|
||||
await setup_platform(hass, CAMERA_DOMAIN)
|
||||
entity_registry = await hass.helpers.entity_registry.async_get_registry()
|
||||
|
||||
entry = entity_registry.async_get("camera.test_cam")
|
||||
assert entry.unique_id == "d0a3a1c316891ceb00c20118aae2a133"
|
||||
|
||||
|
||||
async def test_attributes(hass):
|
||||
"""Test the camera attributes are correct."""
|
||||
await setup_platform(hass, CAMERA_DOMAIN)
|
||||
|
||||
state = hass.states.get("camera.test_cam")
|
||||
assert state.state == STATE_IDLE
|
||||
|
||||
|
||||
async def test_capture_image(hass):
|
||||
"""Test the camera capture image service."""
|
||||
await setup_platform(hass, CAMERA_DOMAIN)
|
||||
|
||||
with patch("abodepy.AbodeCamera.capture") as mock_capture:
|
||||
await hass.services.async_call(
|
||||
ABODE_DOMAIN,
|
||||
"capture_image",
|
||||
{ATTR_ENTITY_ID: "camera.test_cam"},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
mock_capture.assert_called_once()
|
||||
Reference in new issue
Block a user