add test for network.get_free_port

This commit is contained in:
Prodesire 2017-12-08 22:18:06 +08:00
parent 489142364d
commit 50a171af99
1 changed files with 7 additions and 1 deletions

View File

@ -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