Update requirement version and add switcher_kis services (#23477)

* Update aioswitcher requirement to 2019.4.26.

* Removed unnecessary legacy function call.

* Fixed log message capital first letter.

* Replaced None argument with empty dict.

* Replaced guard.

* Added ServiceCallType.

* Added set_auto_off and update_device_name services to the component.

* Added test cases for service calls.

* Conditioned the component services registry with the platform discovery.

* Update homeassistant/components/switcher_kis/__init__.py

Co-Authored-By: TomerFi <tomer.figenblat@gmail.com>

* Update homeassistant/components/switcher_kis/__init__.py

Co-Authored-By: TomerFi <tomer.figenblat@gmail.com>

* Resolved change requests.

* Added ContextType.

* Addes permission verification for service calls.

* Added test cases for permision verification and more.

* Replaced POLICY_CONTROL with the more suited POLICY_EDIT.

* More appropriate function name.

* Added domain and entity_id validation for calling services.

* Removed service for setting the vendor's device name.
This commit is contained in:
Tomer Figenblat authored and Paulus Schoutsen committed 2019-06-14 15:48:21 -07:00
1 parent f9b3ba2887
commit fe8a330a45
10 files changed
+202 -16

No files matched your search

+22 -1
View File
@@ -98,7 +98,9 @@ def mock_bridge_fixture() -> Generator[None, Any, None]:
patchers = [
patch('aioswitcher.bridge.SwitcherV2Bridge.start', new=mock_bridge),
patch('aioswitcher.bridge.SwitcherV2Bridge.stop', new=mock_bridge),
patch('aioswitcher.bridge.SwitcherV2Bridge.queue', get=mock_queue)
patch('aioswitcher.bridge.SwitcherV2Bridge.queue', get=mock_queue),
patch('aioswitcher.bridge.SwitcherV2Bridge.running',
return_value=True)
]
for patcher in patchers:
@@ -130,3 +132,22 @@ def mock_failed_bridge_fixture() -> Generator[None, Any, None]:
for patcher in patchers:
patcher.stop()
@fixture(name='mock_api')
def mock_api_fixture() -> Generator[CoroutineMock, Any, None]:
"""Fixture for mocking aioswitcher.api.SwitcherV2Api."""
mock_api = CoroutineMock()
patchers = [
patch('aioswitcher.api.SwitcherV2Api.connect', new=mock_api),
patch('aioswitcher.api.SwitcherV2Api.disconnect', new=mock_api)
]
for patcher in patchers:
patcher.start()
yield
for patcher in patchers:
patcher.stop()