mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-17 06:06:29 +00:00
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,
|
||||
)
|
||||
|
19
tests/discovery/test_unifi.py
Normal file
19
tests/discovery/test_unifi.py
Normal file
@ -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"})
|
7
tests/services/test_data.py
Normal file
7
tests/services/test_data.py
Normal file
@ -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…
x
Reference in New Issue
Block a user