diff --git a/tests/test_ip.py b/tests/test_ip.py index aae56ef..5b5f9e1 100644 --- a/tests/test_ip.py +++ b/tests/test_ip.py @@ -1,6 +1,25 @@ import pytest from dzgui.api.servers import validate_ip +from dzgui.views.components.entry import validate_ip_truthy + + +@pytest.mark.FOO +@pytest.mark.parametrize( + "ip", + [ + ("foo", False), + ("999", False), + ("192.168.1.101", False), + ("192.168.1.101:", False), + (":1", False), + ("192.168.1.101:27016", True), + ], +) +def test_ip_entry(ip) -> None: + string, state = ip + assert validate_ip_truthy(string) is state + def test_ip_validation() -> None: ip = "192.168.1.1:100" @@ -15,6 +34,7 @@ def test_invalid_port() -> None: with pytest.raises(Exception): validate_ip(ip) + @pytest.mark.parametrize("port", [-1, 65536]) def test_port_out_of_range(port: int) -> None: ip = f"192.168.1.1:{port}" @@ -27,6 +47,7 @@ def test_invalid_socket() -> None: with pytest.raises(Exception): validate_ip(ip) + # TODO: ? def test_ipdb() -> None: pass