# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl GlbDNS.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use strict;
use Test::More qw(no_plan);
BEGIN { use_ok('GlbDNS') };
BEGIN { use_ok('GlbDNS::Zone') };
$GlbDNS::TEST{nosocket} = 1;
$GlbDNS::TEST{noadmin} = 1;
use Data::Dumper;
use Working::Daemon;
my $daemon = Working::Daemon->new();
$daemon->name("glbdns");
$daemon->parse_options(
"port=i" => 53 => "Which port number to listen to",
"address=s" => "0.0.0.0" => "IP Address to listen to",
"syslog" => 0 => "Syslog",
"config=s" => "/etc/glbdns/" => "Configuration directory",
"loglevel=i" => 1 => "What level of messaes to log, higher is more verbose",
"zones=s" => "zone/" => "Where to find zone files",
);
my $glbdns = GlbDNS->new($daemon);
{
# pass no geolocated IP here
my ($rcode, $ans, $auth, $add, $flags) = $glbdns->request("glbdns-show-calling-location.local","IN","TXT","207.171.166.252",undef);
is(scalar @$ans, 1);
is($ans->[0]->txtdata, "LAT: 47.5951 LON: -122.3326 CITY: Seattle");
}