[libflickr-api-perl] 16/40: updated live tests to skip/pass when we cant connect to flickr

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Sat Jul 25 21:12:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to tag 1.08
in repository libflickr-api-perl.

commit b3ab3631b3736b9e2f2a2a6d7f2dad13640171ff
Author: Cal Henderson <cal at iamcal.com>
Date:   Wed Oct 1 15:46:15 2008 +0000

    updated live tests to skip/pass when we cant connect to flickr
---
 Changes           |  4 ++++
 lib/Flickr/API.pm |  2 +-
 test.pl           | 17 ++++++++++++-----
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/Changes b/Changes
index a102a30..7ba7afa 100644
--- a/Changes
+++ b/Changes
@@ -3,3 +3,7 @@ Changes to Flickr::API
 0.10, 2008-09-29
  * Work correctly with latest XML::Parser::Lite::Tree (now requires 0.06)
  * Added patch from Flavio Poletti to allow custom api & auth urls
+
+1.01, 2008-09-30
+ * incorrectly numbered the previous release. gah
+ * updated tests to work when the flickr api isn't hit-able
diff --git a/lib/Flickr/API.pm b/lib/Flickr/API.pm
index c6cf34f..14164ba 100644
--- a/lib/Flickr/API.pm
+++ b/lib/Flickr/API.pm
@@ -10,7 +10,7 @@ use Digest::MD5 qw(md5_hex);
 
 our @ISA = qw(LWP::UserAgent);
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
 sub new {
 	my $class = shift;
diff --git a/test.pl b/test.pl
index 3dcee14..662bd00 100644
--- a/test.pl
+++ b/test.pl
@@ -21,10 +21,12 @@ my $rsp = $api->execute_method('fake.method', {});
 # check we get the 'method not found' error
 #
 
-# this error code will change in future!
-is($rsp->{error_code}, 112, 'checking the error code for "method not found"');
-
-#print "code was $rsp->{error_code}, msg was $rsp->{error_message}\n";
+if ($rsp->{_rc} eq '200'){
+	# this error code may change in future!
+	is($rsp->{error_code}, 112, 'checking the error code for "method not found"');
+}else{
+	is(1, 1, "skipping error code check, since we couldn't reach the API");
+}
 
 
 ##################################################
@@ -33,7 +35,12 @@ is($rsp->{error_code}, 112, 'checking the error code for "method not found"');
 #
 
 $rsp = $api->execute_method('flickr.test.echo', {format => 'fake'});
-is($rsp->{error_code}, 111, 'checking the error code for "format not found"');
+
+if ($rsp->{_rc} eq '200'){
+	is($rsp->{error_code}, 111, 'checking the error code for "format not found"');
+}else{
+	is(1, 1, "skipping error code check, since we couldn't reach the API");
+}
 
 
 ##################################################

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libflickr-api-perl.git



More information about the Pkg-perl-cvs-commits mailing list