Skip to content

Commit 0c12713

Browse files
committed
Add a specific unit test for splitting port with IPv6
The test was copied from greybyte@ccec87c Signed-off-by: kaiyou <pierre@jaury.eu>
1 parent 5dd91cd commit 0c12713

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/unit/utils_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ def test_split_port_range_with_protocol(self):
552552
self.assertEqual(external_port,
553553
[("127.0.0.1", "1000"), ("127.0.0.1", "1001")])
554554

555+
def test_split_port_with_ipv6_address(self):
556+
internal_port, external_port = split_port(
557+
"2001:abcd:ef00::2:1000:2000")
558+
self.assertEqual(internal_port, ["2000"])
559+
self.assertEqual(external_port, [("2001:abcd:ef00::2", "1000")])
560+
555561
def test_split_port_invalid(self):
556562
self.assertRaises(ValueError,
557563
lambda: split_port("0.0.0.0:1000:2000:tcp"))

0 commit comments

Comments
 (0)