From 50a171af997474ed5e270eb71d567b12460eb929 Mon Sep 17 00:00:00 2001 From: Prodesire Date: Fri, 8 Dec 2017 22:18:06 +0800 Subject: [PATCH] add test for network.get_free_port --- tests/test_network.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_network.py b/tests/test_network.py index d3f0cf5..4135ceb 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -1,5 +1,5 @@ import pytest -from pydu.network import dotted_netmask, is_ipv4 +from pydu.network import dotted_netmask, is_ipv4, get_free_port @pytest.mark.parametrize( @@ -20,3 +20,9 @@ class TestIsIPv4Address: @pytest.mark.parametrize('value', ('8.8.8.8.8', 'localhost.localdomain')) def test_invalid(self, value): assert not is_ipv4(value) + + +def test_get_free_port(): + port = get_free_port() + assert isinstance(port, int) + assert port < 65536