Fix services validation & add tests (#1456)
This commit is contained in:
parent
fdef712e01
commit
a320e42ed5
|
@ -8,7 +8,9 @@ from .modules.mysql import SCHEMA_CONFIG_MYSQL
|
|||
|
||||
|
||||
SCHEMA_SERVICES_CONFIG = vol.Schema(
|
||||
{vol.Optional(SERVICE_MQTT, default=dict): schema_or(SCHEMA_CONFIG_MQTT)},
|
||||
{vol.Optional(SERVICE_MYSQL, default=dict): schema_or(SCHEMA_CONFIG_MYSQL)},
|
||||
{
|
||||
vol.Optional(SERVICE_MQTT, default=dict): schema_or(SCHEMA_CONFIG_MQTT),
|
||||
vol.Optional(SERVICE_MYSQL, default=dict): schema_or(SCHEMA_CONFIG_MYSQL),
|
||||
},
|
||||
extra=vol.REMOVE_EXTRA,
|
||||
)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
"""Test unifi discovery."""
|
||||
|
||||
import voluptuous as vol
|
||||
import pytest
|
||||
|
||||
from hassio.discovery.validate import valid_discovery_config
|
||||
|
||||
|
||||
def test_good_config():
|
||||
"""Test good unifi config."""
|
||||
|
||||
valid_discovery_config("unifi", {"host": "test", "port": 3812})
|
||||
|
||||
|
||||
def test_bad_config():
|
||||
"""Test good unifi config."""
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
valid_discovery_config("unifi", {"host": "test"})
|
|
@ -0,0 +1,7 @@
|
|||
"""Test services data."""
|
||||
|
||||
|
||||
def test_data_initial(coresys):
|
||||
"""Test initial data for services."""
|
||||
assert coresys.services.data.mqtt == {}
|
||||
assert coresys.services.data.mysql == {}
|
Loading…
Reference in New Issue