Update API data for deconz (#989)

* Update API data for deconz

* Fix tests
This commit is contained in:
Pascal Vizeli 2019-04-01 16:58:58 +02:00 committed by GitHub
parent 8451020afe
commit 2ae93ae7b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -6,3 +6,5 @@ ATTR_PORT = "port"
ATTR_PROTOCOL = "protocol"
ATTR_SSL = "ssl"
ATTR_USERNAME = "username"
ATTR_API_KEY = "api_key"
ATTR_SERIAL = "serial"

View File

@ -3,9 +3,14 @@ import voluptuous as vol
from hassio.validate import NETWORK_PORT
from ..const import ATTR_HOST, ATTR_PORT
from ..const import ATTR_HOST, ATTR_PORT, ATTR_API_KEY, ATTR_SERIAL
SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): NETWORK_PORT}
{
vol.Required(ATTR_HOST): vol.Coerce(str),
vol.Required(ATTR_PORT): NETWORK_PORT,
vol.Required(ATTR_SERIAL): vol.Coerce(str),
vol.Required(ATTR_API_KEY): vol.Coerce(str),
}
)

View File

@ -9,11 +9,14 @@ from hassio.discovery.validate import valid_discovery_config
def test_good_config():
"""Test good deconz config."""
valid_discovery_config("deconz", {"host": "test", "port": 3812})
valid_discovery_config(
"deconz",
{"host": "test", "port": 3812, "api_key": "MY_api_KEY99", "serial": "xyz"},
)
def test_bad_config():
"""Test good deconz config."""
with pytest.raises(vol.Invalid):
valid_discovery_config("deconz", {"host": "test"})
valid_discovery_config("deconz", {"host": "test", "port": 8080})