-
-
Notifications
You must be signed in to change notification settings - Fork 32k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #10773: Demo Alarm Broken #10777
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
"""The tests for the manual Alarm Control Panel component.""" | ||
from datetime import timedelta | ||
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.const import ( | ||
|
@@ -11,6 +13,8 @@ | |
from homeassistant.components import alarm_control_panel | ||
import homeassistant.util.dt as dt_util | ||
|
||
from tests.common import assert_setup_component | ||
|
||
from tests.common import fire_time_changed, get_test_home_assistant | ||
|
||
CODE = 'HELLO_CODE' | ||
|
@@ -27,6 +31,13 @@ def tearDown(self): # pylint: disable=invalid-name | |
"""Stop down everything that was started.""" | ||
self.hass.stop() | ||
|
||
def test_setup_demo_platform(self): | ||
"""Test setup.""" | ||
mock = MagicMock(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. statement ends with a semicolon |
||
add_devices = mock.MagicMock() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's the code you originally suggested. I had to import MagicMock as it wasn't already imported in this file and and to define what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be like this, since you import add_devices = MagicMock() |
||
demo.setup_platform(self.hass, {}, add_devices) | ||
add_devices.assert_called_once() | ||
|
||
def test_arm_home_no_pending(self): | ||
"""Test arm home method.""" | ||
self.assertTrue(setup_component( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'tests.common.assert_setup_component' imported but unused