Add COMPONENT_SCHEMA and use it in alarm_control_panel (#20224)

* Add COMPONENT_SCHEMA and use in alarm and mqtt

* Revert MQTT changes

* Lint

* Small tweak

* Add tests

* Rename COMPONENT_SCHEMA to PLATFORM_SCHEMA_BASE

* Fix tests

* Improve tests
This commit is contained in:
emontnemery 2019-01-29 01:14:55 +01:00 committed by Paulus Schoutsen
parent bb4ca1f525
commit d7ba2aad1d
5 changed files with 137 additions and 9 deletions

View file

@ -450,8 +450,8 @@ class MockModule:
# pylint: disable=invalid-name
def __init__(self, domain=None, dependencies=None, setup=None,
requirements=None, config_schema=None, platform_schema=None,
async_setup=None, async_setup_entry=None,
async_unload_entry=None):
platform_schema_base=None, async_setup=None,
async_setup_entry=None, async_unload_entry=None):
"""Initialize the mock module."""
self.DOMAIN = domain
self.DEPENDENCIES = dependencies or []
@ -463,6 +463,9 @@ class MockModule:
if platform_schema is not None:
self.PLATFORM_SCHEMA = platform_schema
if platform_schema_base is not None:
self.PLATFORM_SCHEMA_BASE = platform_schema_base
if setup is not None:
# We run this in executor, wrap it in function
self.setup = lambda *args: setup(*args)