Add Add-on discovery schema for rtsp-to-webrtc (#3392)

This commit is contained in:
Allen Porter 2022-01-05 02:30:15 -08:00 committed by GitHub
parent fefc99e825
commit 809ac1ffca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,10 @@
"""Discovery service for RTSPtoWebRTC."""
import voluptuous as vol
from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): str, vol.Required(ATTR_PORT): network_port}
)

View File

@ -0,0 +1,21 @@
"""Test rtsp_to_webrtc discovery."""
import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config
SERVICE = "rtsp_to_webrtc"
def test_good_config():
"""Test good config."""
valid_discovery_config(SERVICE, {"host": "test", "port": 3812})
def test_bad_config():
"""Test bad config."""
with pytest.raises(vol.Invalid):
valid_discovery_config(SERVICE, {"host": "test"})