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,43 @@
|
||||
"""Tests for the Abode module."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.abode import (
|
||||
DOMAIN as ABODE_DOMAIN,
|
||||
SERVICE_CAPTURE_IMAGE,
|
||||
SERVICE_SETTINGS,
|
||||
SERVICE_TRIGGER_AUTOMATION,
|
||||
)
|
||||
from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN
|
||||
|
||||
from .common import setup_platform
|
||||
|
||||
|
||||
async def test_change_settings(hass):
|
||||
"""Test change_setting service."""
|
||||
await setup_platform(hass, ALARM_DOMAIN)
|
||||
|
||||
with patch("abodepy.Abode.set_setting") as mock_set_setting:
|
||||
await hass.services.async_call(
|
||||
ABODE_DOMAIN,
|
||||
SERVICE_SETTINGS,
|
||||
{"setting": "confirm_snd", "value": "loud"},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
mock_set_setting.assert_called_once()
|
||||
|
||||
|
||||
async def test_unload_entry(hass):
|
||||
"""Test unloading the Abode entry."""
|
||||
mock_entry = await setup_platform(hass, ALARM_DOMAIN)
|
||||
|
||||
with patch("abodepy.Abode.logout") as mock_logout, patch(
|
||||
"abodepy.event_controller.AbodeEventController.stop"
|
||||
) as mock_events_stop:
|
||||
assert await hass.config_entries.async_unload(mock_entry.entry_id)
|
||||
mock_logout.assert_called_once()
|
||||
mock_events_stop.assert_called_once()
|
||||
|
||||
assert not hass.services.has_service(ABODE_DOMAIN, SERVICE_SETTINGS)
|
||||
assert not hass.services.has_service(ABODE_DOMAIN, SERVICE_CAPTURE_IMAGE)
|
||||
assert not hass.services.has_service(ABODE_DOMAIN, SERVICE_TRIGGER_AUTOMATION)
|
||||
Reference in new issue
Block a user