1# -*- perl -*-
2
3# t/006_parseauthorinfoxml.t - checks loading authorinfo api query and results parsing
4
5use Test::More tests => 3;
6use XML::XPath;
7use XML::Parser;
8use WebService::Technorati;
9use FindBin qw($Bin);
10
11my $apiKey = 'a_key_that_wont_work_with_a_live_query';
12my $username = 'spidaman';
13my $t = WebService::Technorati->new(key => $apiKey);
14my $cq = $t->getAuthorinfoApiQuery($username);
15
16my $parser = new XML::Parser(NoLWP => 1);
17my $result_xp = XML::XPath->new(
18    parser => $parser,
19    filename => "$Bin/testdata/getinfo.xml");
20$cq->readResults($result_xp);
21
22my $author = $cq->getSubjectAuthor();
23isa_ok($author, 'WebService::Technorati::Author');
24my @blogs = $cq->getClaimedBlogs();
25is(0, $#blogs);
26my $blog = pop(@blogs);
27isa_ok($blog, 'WebService::Technorati::Blog');
28
29
30
31