Security fix & lock for HomeMatic (#11980)

* HomeMatic KeyMatic device become a real lock component

* Adds supported features to lock component.

Locks may are capable to open the door latch.
If component is support it, the SUPPORT_OPENING bitmask can be supplied in the supported_features property.

* hound improvements.

* Travis improvements.

* Improvements from review process

* Simplifies is_locked method

* Adds an openable lock in the lock demo component

* removes blank line

* Adds test for openable demo lock and lint and reviewer improvements.

* adds new line...

* Comment end with a period.

* Additional blank line.

* Mock service based testing, lint fixes

* Update description
This commit is contained in:
Patrick Hofmann
2018-03-25 18:23:29 -07:00
committed by Paulus Schoutsen
parent 8a204fd15b
commit 0d48a8eec6
5 changed files with 121 additions and 10 deletions
+9 -3
View File
@@ -4,11 +4,10 @@ import unittest
from homeassistant.setup import setup_component
from homeassistant.components import lock
from tests.common import get_test_home_assistant
from tests.common import get_test_home_assistant, mock_service
FRONT = 'lock.front_door'
KITCHEN = 'lock.kitchen_door'
OPENABLE_LOCK = 'lock.openable_lock'
class TestLockDemo(unittest.TestCase):
@@ -48,3 +47,10 @@ class TestLockDemo(unittest.TestCase):
self.hass.block_till_done()
self.assertFalse(lock.is_locked(self.hass, FRONT))
def test_opening(self):
"""Test the opening of a lock."""
calls = mock_service(self.hass, lock.DOMAIN, lock.SERVICE_OPEN)
lock.open_lock(self.hass, OPENABLE_LOCK)
self.hass.block_till_done()
self.assertEqual(1, len(calls))