UT: Add missing SocketAddress tests for invalid ports

This commit is contained in:
Mike Salvatore 2022-09-29 11:37:54 -04:00
parent 64b9432bb9
commit 17017d6962
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from common.types import SocketAddress
GOOD_IP = "192.168.1.1" GOOD_IP = "192.168.1.1"
BAD_IP = "192.168.1.999" BAD_IP = "192.168.1.999"
GOOD_PORT = 1234 GOOD_PORT = 1234
BAD_PORT = 99999 BAD_PORTS = [99999, 0, -1]
def test_socket_address__from_string(): def test_socket_address__from_string():
@ -26,7 +26,7 @@ def test_socket_address__from_string():
f"{GOOD_IP}:", f"{GOOD_IP}:",
f":{GOOD_PORT}", f":{GOOD_PORT}",
f"{BAD_IP}:{GOOD_PORT}", f"{BAD_IP}:{GOOD_PORT}",
f"{GOOD_IP}:{BAD_PORT}", *[f"{GOOD_IP}:{bad_port}" for bad_port in BAD_PORTS],
], ],
) )
def test_socket_address__from_string_raises(bad_address: str): def test_socket_address__from_string_raises(bad_address: str):