Commit 043a8ccf by Dudás Ádám

vm: tests for finding unused ports

parent f70812a3
from django.test import TestCase from django.test import TestCase
from ..models.common import (
Lease
)
from ..models.instance import ( from ..models.instance import (
InstanceTemplate, Instance find_unused_port, InstanceTemplate, Instance
) )
from ..models.network import ( from ..models.network import (
Interface Interface
) )
from ..models.common import (
Lease
) class PortFinderTestCase(TestCase):
def test_find_unused_port_without_used_ports(self):
port = find_unused_port(port_range=(1000, 2000))
assert port is not None
def test_find_unused_port_with_fully_saturated_range(self):
r = (10, 20)
port = find_unused_port(port_range=r, used_ports=range(*r))
assert port is None
class TemplateTestCase(TestCase): class TemplateTestCase(TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment