mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
* Fixes #10773: Demo Alarm Broken * Added test for platform setup * Remove unused import * Lint fix * Rework assert to work with python 3.5
This commit is contained in:
parent
fcc164c31e
commit
2817f03378
@ -7,7 +7,7 @@ https://home-assistant.io/components/demo/
|
|||||||
import homeassistant.components.alarm_control_panel.manual as manual
|
import homeassistant.components.alarm_control_panel.manual as manual
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
|
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_ARMED_NIGHT,
|
||||||
STATE_ALARM_TRIGGERED, CONF_PENDING_TIME)
|
STATE_ALARM_ARMED_CUSTOM_BYPASS, STATE_ALARM_TRIGGERED, CONF_PENDING_TIME)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
@ -23,6 +23,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
STATE_ALARM_ARMED_NIGHT: {
|
STATE_ALARM_ARMED_NIGHT: {
|
||||||
CONF_PENDING_TIME: 5
|
CONF_PENDING_TIME: 5
|
||||||
},
|
},
|
||||||
|
STATE_ALARM_ARMED_CUSTOM_BYPASS: {
|
||||||
|
CONF_PENDING_TIME: 5
|
||||||
|
},
|
||||||
STATE_ALARM_TRIGGERED: {
|
STATE_ALARM_TRIGGERED: {
|
||||||
CONF_PENDING_TIME: 5
|
CONF_PENDING_TIME: 5
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
"""The tests for the manual Alarm Control Panel component."""
|
"""The tests for the manual Alarm Control Panel component."""
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch, MagicMock
|
||||||
|
from homeassistant.components.alarm_control_panel import demo
|
||||||
|
|
||||||
|
|
||||||
from homeassistant.setup import setup_component
|
from homeassistant.setup import setup_component
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -27,6 +29,13 @@ class TestAlarmControlPanelManual(unittest.TestCase):
|
|||||||
"""Stop down everything that was started."""
|
"""Stop down everything that was started."""
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
|
||||||
|
def test_setup_demo_platform(self):
|
||||||
|
"""Test setup."""
|
||||||
|
mock = MagicMock()
|
||||||
|
add_devices = mock.MagicMock()
|
||||||
|
demo.setup_platform(self.hass, {}, add_devices)
|
||||||
|
self.assertEquals(add_devices.call_count, 1)
|
||||||
|
|
||||||
def test_arm_home_no_pending(self):
|
def test_arm_home_no_pending(self):
|
||||||
"""Test arm home method."""
|
"""Test arm home method."""
|
||||||
self.assertTrue(setup_component(
|
self.assertTrue(setup_component(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user