示例#1
0
def test_next_safe_port_less_than_range_exception():
    current_port = str(int(FIRST_PORT) - 100)

    with pytest.raises(ValueError):
        _server.next_safe_port(SAFE_PORT_RANGE, current_port)
示例#2
0
def test_next_safe_port_after():
    safe_port = _server.next_safe_port(SAFE_PORT_RANGE, FIRST_PORT)
    next_safe_port = str(int(FIRST_PORT) + 1)

    assert safe_port == next_safe_port
示例#3
0
def test_next_safe_port_greater_than_range_exception():
    current_port = str(int(LAST_PORT) + 1)

    with pytest.raises(ValueError):
        _server.next_safe_port(SAFE_PORT_RANGE, current_port)
示例#4
0
def test_next_safe_port_first():
    safe_port = _server.next_safe_port(SAFE_PORT_RANGE)
    assert safe_port == FIRST_PORT