Changeset 10117 for lang/perl/WebService-Simple/trunk/t
- Timestamp:
- 04/22/08 10:17:43 (7 months ago)
- Location:
- lang/perl/WebService-Simple/trunk/t
- Files:
-
- 1 added
- 1 modified
-
02_parser_libxml.t (modified) (3 diffs)
-
02_parser_xml_simple.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/WebService-Simple/trunk/t/02_parser_libxml.t
r10077 r10117 2 2 use Test::More; 3 3 4 my $flickr_api_key = $ENV{FLICKR_API_KEY}; 4 5 BEGIN 5 6 { … … 8 9 plan(skip_all => "XML::LibXML not installed"); 9 10 } else { 10 plan(tests => 2);11 plan(tests => 7); 11 12 } 12 13 use_ok("WebService::Simple"); … … 15 16 { 16 17 my $service = WebService::Simple->new( 17 base_url => "http://example.com/hoge", 18 response_parser => "XML::LibXML" 18 base_url => "http://api.flickr.com/services/rest/", 19 response_parser => 'XML::LibXML', 20 params => { 21 api_key => $flickr_api_key 22 } 19 23 ); 20 24 isa_ok( $service->response_parser, "WebService::Simple::Parser::XML::LibXML"); 25 26 SKIP: { 27 if (! $flickr_api_key ) { 28 skip( "Please set FLICKR_API_KEY to enable this test", 1 ); 29 } 30 31 my $response = $service->get( { method => "flickr.test.echo", name => "value" } ); 32 my $xml = $response->parse_response; 33 34 isa_ok( $xml, 'XML::LibXML::Document' ); 35 is( $xml->findvalue( '/rsp/@stat' ), 'ok', '/rsp/@stat' ); 36 is( $xml->findvalue( '/rsp/api_key' ), $flickr_api_key, '/rsp/api_key', ); 37 is( $xml->findvalue( '/rsp/name' ), "value", '/rsp/name' ); 38 is( $xml->findvalue( '/rsp/method' ), 'flickr.test.echo', '/rsp/method' ); 39 } 21 40 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)