From 809ac1ffcaa6d24155eac31a308b7658170b47a4 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Wed, 5 Jan 2022 02:30:15 -0800 Subject: [PATCH] Add Add-on discovery schema for rtsp-to-webrtc (#3392) --- .../discovery/services/rtsp_to_webrtc.py | 10 +++++++++ tests/discovery/test_rtsp_to_webrtc.py | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 supervisor/discovery/services/rtsp_to_webrtc.py create mode 100644 tests/discovery/test_rtsp_to_webrtc.py diff --git a/supervisor/discovery/services/rtsp_to_webrtc.py b/supervisor/discovery/services/rtsp_to_webrtc.py new file mode 100644 index 000000000..cdb3f3a0a --- /dev/null +++ b/supervisor/discovery/services/rtsp_to_webrtc.py @@ -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} +) diff --git a/tests/discovery/test_rtsp_to_webrtc.py b/tests/discovery/test_rtsp_to_webrtc.py new file mode 100644 index 000000000..9a4c7a20f --- /dev/null +++ b/tests/discovery/test_rtsp_to_webrtc.py @@ -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"})