|
Revision 10117, 0.9 kB
(checked in by daisuke, 5 years ago)
|
|
more testing using flickr
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use Test::More ( tests => 4 ); |
|---|
| 3 | |
|---|
| 4 | my $flickr_api_key = $ENV{FLICKR_API_KEY}; |
|---|
| 5 | BEGIN |
|---|
| 6 | { |
|---|
| 7 | use_ok("WebService::Simple"); |
|---|
| 8 | } |
|---|
| 9 | |
|---|
| 10 | { |
|---|
| 11 | my $service = WebService::Simple->new( |
|---|
| 12 | base_url => "http://api.flickr.com/services/rest/", |
|---|
| 13 | params => { |
|---|
| 14 | api_key => $flickr_api_key |
|---|
| 15 | } |
|---|
| 16 | ); |
|---|
| 17 | |
|---|
| 18 | isa_ok( $service->response_parser, "WebService::Simple::Parser::XML::Simple"); |
|---|
| 19 | |
|---|
| 20 | SKIP: { |
|---|
| 21 | if (! $flickr_api_key ) { |
|---|
| 22 | skip( "Please set FLICKR_API_KEY to enable this test", 2 ); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | my $response = $service->get( { method => "flickr.test.echo", name => "value" } ); |
|---|
| 26 | my $xml = $response->parse_response; |
|---|
| 27 | |
|---|
| 28 | isa_ok( $xml, 'HASH' ); |
|---|
| 29 | is_deeply( |
|---|
| 30 | $xml, |
|---|
| 31 | { |
|---|
| 32 | 'name' => 'value', |
|---|
| 33 | 'method' => 'flickr.test.echo', |
|---|
| 34 | 'api_key' => $flickr_api_key, |
|---|
| 35 | 'stat' => 'ok' |
|---|
| 36 | } |
|---|
| 37 | ); |
|---|
| 38 | } |
|---|
| 39 | } |
|---|