Permalink
Browse files

Test JSON status interface

  • Loading branch information...
1 parent dab8844 commit cb12ec740fb106504e8d1198aa3d200ead20cb6f @abh committed Feb 26, 2012
Showing with 16 additions and 3 deletions.
  1. +6 −2 Makefile.PL
  2. +10 −1 t/version.t
View
@@ -13,8 +13,12 @@ WriteMakefile
# PM => {
# 'GeoDNS.pm' => '$(INST_LIBDIR)/App/HWD.pm',
# },
- PREREQ_PM =>
- {
+ MIN_PERL_VERSION => '5.008',
+ BUILD_REQUIRES => {
+ 'ExtUtils::MakeMaker' => '6.48',
+ 'Test::Simple' => '0.90',
+ },
+ PREREQ_PM => {
'Net::DNS' => 0.67,
'Geo::IP' => 1.28,
'List::Util' => 0,
View
@@ -1,5 +1,6 @@
-use Test::More qw(no_plan);
+use Test::More;
use strict;
+use JSON qw(decode_json);
my @ans;
@@ -32,3 +33,11 @@ like($ans[1]->[0]->rdatastr, qr!q: 5,!, 'five queries now');
ok(@ans = $g2->reply_handler("status.example.com", "IN", "ANY", "192.168.0.10"), "status request, any");
like($ans[1]->[0]->rdatastr, qr!q: 1,!, 'g2 has only done one query now');
+
+ok(@ans = $g->reply_handler("_status.pgeodns", "IN", "TXT", "192.168.0.10"), "_status request (json), txt");
+my $x = join "\n", $ans[1]->[0]->char_str_list;
+#warn "[", ref $x, "] $x";
+ok(my $data = decode_json($x), "decode json");
+like($data->{v}, qr!v$GeoDNS::VERSION/!, 'got the version back');
+
+done_testing();

0 comments on commit cb12ec7

Please sign in to comment.