Exemplo n.º 1
0
def test_ipv4prefix_parameter():
    assert IPv4PrefixParameter().clean("192.168.0.0/16") == "192.168.0.0/16"
    with pytest.raises(InterfaceTypeError):
        IPv4PrefixParameter().clean("192.168.0.256")
    with pytest.raises(InterfaceTypeError):
        IPv4PrefixParameter().clean("192.168.0.0/33")
    with pytest.raises(InterfaceTypeError):
        IPv4PrefixParameter().clean("192.168.0.0/-5")
Exemplo n.º 2
0
def test_ipv4prefix_parameter_error(raw, config):
    with pytest.raises(InterfaceTypeError):
        assert IPv4PrefixParameter(**config).clean(raw)
Exemplo n.º 3
0
def test_ipv4prefix_parameter(raw, config, expected):
    assert IPv4PrefixParameter(**config).clean(raw) == expected
Exemplo n.º 4
0
 def decode_ipv4_prefix(event, value):
     return IPv4PrefixParameter().clean(value)