Ejemplo n.º 1
0
def test_port_validator_invalid_types():
    """Test the port validator using invalid/unsupported types"""

    assert port_validator(22.0) is False
    assert port_validator("42") is False
    assert port_validator([3, 1, 4]) is False
Ejemplo n.º 2
0
def test_port_validator_invalid_nums():
    """Test the port validator with invalid numbers"""

    assert port_validator(PORT_NUMBER_MIN_VALUE - 1) is False
    assert port_validator(PORT_NUMBER_MAX_VALUE + 1) is False
    assert port_validator(0xDEADBEEF) is False
Ejemplo n.º 3
0
def test_port_validator_bool():
    """Test the port validator with None"""

    assert port_validator(False) is True
    assert port_validator(True) is True
Ejemplo n.º 4
0
def test_port_validator_valid_nums():
    """Test the port validator with valid numbers"""

    assert port_validator(13) is True
    assert port_validator(21) is True
    assert port_validator(22) is True
    assert port_validator(25) is True
    assert port_validator(80) is True
    assert port_validator(104) is True
    assert port_validator(192) is True
    assert port_validator(443) is True
    assert port_validator(554) is True
    assert port_validator(3724) is True
    assert port_validator(8080) is True
    assert port_validator(25565) is True
Ejemplo n.º 5
0
def test_port_validator_none():
    """Test the port validator with None"""

    assert port_validator(None) is True