예제 #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