Add tests for jeb_utils.utils.test_is_valid_host

This commit is contained in:
2026-04-04 16:24:22 +02:00
parent 89eacfdbcb
commit 560241179a
+43
View File
@@ -0,0 +1,43 @@
from src.jeb_utils.utils import is_valid_host
import pytest
@pytest.mark.parametrize('host,expected', [
('0.0.0.0', True),
('0.0.0.1', True),
('1.0.0.1', True),
('1.1.1.1', True),
('255.255.255.255', True),
('42.54.32.78', True),
('0.0.255.255', True),
('255.255.0.0', True),
('192.168.0.0', True),
('192.168.23.1', True),
('10.0.0.0', True),
('10.0.0.1', True),
('10.1.1.1', True),
('10.54.65.129', True),
('127.0.0.1', True),
('127.0.0.42', True),
('127.0.1.42', True),
('0.0.a0.0', False),
('a0.0.0.0', False),
('a0.0.,0.0', False),
('a0.0.0,0', False),
('a0.0.0,0.0', False),
('256.255.255.255', False),
('-1.0.0.0', False),
('0.0.0', False),
('0.0.1', False),
('1.0.0', False),
('1.0.1', False),
('1.1.1', False),
('0.0.0.0:0', False),
('0.0.0.0:1', False),
('0.0.0.0:65535', False),
('0.0.0.0:65536', False),
('', False),
('', False),
])
def test_is_valid_host(host, expected):
assert is_valid_host(host) == expected