add tcp/udp port to config validation (#2854)

This commit is contained in:
Pascal Vizeli 2016-08-17 05:55:29 +02:00 committed by Paulus Schoutsen
parent 781fe9c54e
commit 4fcfffc172
6 changed files with 26 additions and 20 deletions

View file

@ -47,6 +47,18 @@ def test_longitude():
schema(value)
def test_port():
"""Test tcp/udp network port."""
schema = vol.Schema(cv.port)
for value in('invalid', None, -1, 0, 80000, '81000'):
with pytest.raises(vol.MultipleInvalid):
schema(value)
for value in ('1000', 21, 24574):
schema(value)
def test_platform_config():
"""Test platform config validation."""
for value in (