Esempio n. 1
0
def test_tcp_query():
    """Tests for successful DNS query using tcp."""
    assert dnsck_query("8.8.8.8", "google.com", "AAAA", 1, True) == 0
Esempio n. 2
0
def test_tcp_no_records():
    """Tests response with no records returned."""
    assert dnsck_query("8.8.8.8", "test.google.com", "A", 1, True) == 0
Esempio n. 3
0
def test_tcp_unknown_rec_type():
    """Unknown record types should raise an exception and exit."""
    with pytest.raises(SystemExit):
        assert dnsck_query("8.8.8.8", "google.com", "abc", 1, True)
Esempio n. 4
0
def test_tcp_bad_server():
    """Tests response with bad server IP address."""
    assert dnsck_query("8.8.8.88", "google.com", "A", 1, True) == 1
Esempio n. 5
0
def test_udp_query():
    """Tests for successful DNS query using UDP."""
    assert dnsck_query("8.8.8.8", "google.com", "a", 1) == 0