mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 05:06:30 +00:00
Add Add-on discovery schema for rtsp-to-webrtc (#3392)
This commit is contained in:
parent
fefc99e825
commit
809ac1ffca
10
supervisor/discovery/services/rtsp_to_webrtc.py
Normal file
10
supervisor/discovery/services/rtsp_to_webrtc.py
Normal 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}
|
||||||
|
)
|
21
tests/discovery/test_rtsp_to_webrtc.py
Normal file
21
tests/discovery/test_rtsp_to_webrtc.py
Normal 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"})
|
Loading…
x
Reference in New Issue
Block a user