summaryrefslogtreecommitdiff
path: root/t/axfr.t
blob: 387465552a97b9da582dc3c5989490c7131655b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use Test::More;
use Test::Fatal;

BEGIN { use_ok( 'Net::LDNS' ) }

SKIP: {
    skip 'no network', 3 if $ENV{TEST_NO_NETWORK};

    my $res = Net::LDNS->new( '46.21.106.227' );
    my $res2 = Net::LDNS->new( '192.36.144.107' );

    my $counter = 0;
    my $return = $res->axfr( 'cyberpomo.com',
        sub {
            my ($rr) = @_;
            $counter += 1;
            if ($rr->type eq 'CNAME') {
                return 0;
            } else {
                return 1;
            }
        });
    ok(!$return, 'Terminated early');
    ok(($counter > 1), 'Saw more than one entry (' . $counter . ')');

    like( exception { $res2->axfr( 'iis.se', sub { return 1 })}, qr/NOTAUTH/, 'Expected exception');
}

done_testing;