Exemple #1
0
def test_error_on_invalid_data() -> None:
    with open_test_file("ripestat/error_in_list.json") as json_input:
        with pytest.raises(ValueError):
            list(parse_ripestat(json_input))
Exemple #2
0
def test_error_on_status_code() -> None:
    with open_test_file("ripestat/error_status_code.json") as json_input:
        with pytest.raises(ValueError):
            parse_ripestat(json_input)
Exemple #3
0
def test_error_on_data_call_status() -> None:
    with open_test_file("ripestat/error_data_call_status.json") as json_input:
        with pytest.raises(ValueError):
            parse_ripestat(json_input)
def test_valid() -> None:
    with open_test_file("ripestat/valid.json") as json_input:
        assert list(parse_ripestat(json_input)) == [ipaddress.IPv4Network("127.0.0.0/24")]
Exemple #5
0
def test_messages_on_error() -> None:
    with open_test_file("ripestat/error_messages.json") as json_input:
        with pytest.raises(ValueError, match="(?s)message=foo.*bar"):
            parse_ripestat(json_input)
Exemple #6
0
def test_explain_error_on_data_call_status() -> None:
    with open_test_file("ripestat/error_data_call_status.json") as json_input:
        with pytest.raises(ValueError, match="data_call_status.*deprecated"):
            parse_ripestat(json_input)
Exemple #7
0
def test_explain_error_on_status() -> None:
    with open_test_file("ripestat/error_status.json") as json_input:
        with pytest.raises(ValueError, match="status=not ok"):
            parse_ripestat(json_input)