[libflickr-api-perl] 09/40: imported 0.08
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 f3f37fcd7fd2085b5713c3c45a6e93242ae68174
Author: Cal Henderson <cal at iamcal.com>
Date: Wed Apr 23 05:52:28 2008 +0000
imported 0.08
---
MANIFEST | 1 +
META.yml | 17 +++++++++++++++++
Makefile.PL | 1 +
README | 6 +++++-
lib/Flickr/API.pm | 2 +-
test.pl | 51 +++++++++++++++++++++++++++++++++++++++------------
6 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/MANIFEST b/MANIFEST
index 73e1066..db78f43 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,3 +5,4 @@ Makefile.PL
MANIFEST
README
test.pl
+META.yml Module meta-data (added by MakeMaker)
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..d06682c
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,17 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Flickr-API
+version: 0.08
+version_from: lib/Flickr/API.pm
+installdirs: site
+requires:
+ Digest::MD5: 0
+ HTTP::Request: 0
+ HTTP::Response: 0
+ LWP::UserAgent: 0
+ Test::More: 0
+ URI: 1.18
+ XML::Parser::Lite::Tree: 0.03
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
diff --git a/Makefile.PL b/Makefile.PL
index e6a463f..db09cf7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -10,5 +10,6 @@ WriteMakefile(
'URI' => 1.18,
'XML::Parser::Lite::Tree' => 0.03,
'Digest::MD5' => 0,
+ 'Test::More' => 0,
},
);
diff --git a/README b/README
index 76326a0..96aca6d 100644
--- a/README
+++ b/README
@@ -21,10 +21,14 @@ This module requires these other modules and libraries:
XML::Parser::Lite::Tree
LWP::UserAgent
Digest::MD5
+ HTTP::Request
+ HTTP::Response
+ URI
+ Test::More
COPYRIGHT AND LICENCE
-Copyright (C) 2004-2005 Cal Henderson <cal at iamcal.com>
+Copyright (C) 2004-2006 Cal Henderson <cal at iamcal.com>
License: Perl Artistic License
diff --git a/lib/Flickr/API.pm b/lib/Flickr/API.pm
index d099602..36af061 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 = '0.07';
+our $VERSION = '0.08';
sub new {
my $class = shift;
diff --git a/test.pl b/test.pl
index 500dfda..0594f6d 100644
--- a/test.pl
+++ b/test.pl
@@ -1,8 +1,8 @@
-use Test;
-BEGIN { plan tests => 8 };
+use Test::More;
+BEGIN { plan tests => 17 };
+
+BEGIN { use_ok( 'Flickr::API' ); }
-use Flickr::API;
-ok(1); #
##################################################
#
@@ -21,18 +21,28 @@ my $rsp = $api->execute_method('fake.method', {});
# check we get the 'method not found' error
#
-ok($rsp->{error_code} == 0); # this error code will change in future!
+# 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";
##################################################
#
+# check the 'format not found' error is working
+#
+
+$rsp = $api->execute_method('flickr.test.echo', {format => 'fake'});
+is($rsp->{error_code}, 111, 'checking the error code for "format not found"');
+
+
+##################################################
+#
# check the signing works properly
#
-ok('466cd24ced0b23df66809a4d2dad75f8' eq $api->sign_args({'foo' => 'bar'}));
-ok('f320caea573c1b74897a289f6919628c' eq $api->sign_args({'foo' => undef}));
+ok('466cd24ced0b23df66809a4d2dad75f8' eq $api->sign_args({'foo' => 'bar'}), "Signing test 1");
+ok('f320caea573c1b74897a289f6919628c' eq $api->sign_args({'foo' => undef}), "Signing test 2");
##################################################
@@ -42,10 +52,27 @@ ok('f320caea573c1b74897a289f6919628c' eq $api->sign_args({'foo' => undef}));
my $uri = $api->request_auth_url('r', 'my_frob');
-ok($uri->query eq 'api_sig=d749e3a7bd27da9c8af62a15f4c7b48f&perms=r&frob=my_frob&api_key=made_up_key');
-ok($uri->path eq '/services/auth');
-ok($uri->host eq 'flickr.com');
-ok($uri->scheme eq 'http');
+my %expect = &parse_query('api_sig=d749e3a7bd27da9c8af62a15f4c7b48f&perms=r&frob=my_frob&api_key=made_up_key');
+my %got = &parse_query($uri->query);
+
+sub parse_query {
+ my %hash;
+ foreach my $pair (split(/\&/, shift)) {
+ my ($name, $value) = split(/\=/, $pair);
+ $hash{$name} = $value;
+ }
+ return(%hash);
+}
+foreach my $item (keys %expect) {
+ is($expect{$item}, $got{$item}, "Checking that the $item item in the query matches");
+}
+foreach my $item (keys %got) {
+ is($expect{$item}, $got{$item}, "Checking that the $item item in the query matches in reverse");
+}
+
+ok($uri->path eq '/services/auth', "Checking correct return path");
+ok($uri->host eq 'flickr.com', "Checking return domain");
+ok($uri->scheme eq 'http', "Checking return protocol");
##################################################
@@ -56,5 +83,5 @@ ok($uri->scheme eq 'http');
$api = new Flickr::API({'key' => 'key'});
$uri = $api->request_auth_url('r', 'frob');
-ok(!defined $uri);
+ok(!defined $uri, "Checking URL generation without a secret");
--
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