[libflickr-api-perl] 33/40: use more of the Test::More tools
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Sat Jul 25 21:12:19 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 7f14b0c7ceaaf8d61eeaded9a2f2e808af22effe
Author: Gabor Szabo <gabor at szabgab.com>
Date: Tue Jun 18 21:45:22 2013 +0300
use more of the Test::More tools
---
t/01-test.t | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/t/01-test.t b/t/01-test.t
index 5697b1d..201109c 100644
--- a/t/01-test.t
+++ b/t/01-test.t
@@ -1,7 +1,9 @@
-use Test::More;
-BEGIN { plan tests => 19 };
+use strict;
+use warnings;
-BEGIN { use_ok( 'Flickr::API' ); }
+use Test::More tests => 20;
+
+use Flickr::API;
##################################################
@@ -9,11 +11,13 @@ BEGIN { use_ok( 'Flickr::API' ); }
# create an api object
#
-my $api = new Flickr::API({
+my $api = Flickr::API->new({
'key' => 'made_up_key',
'secret' => 'my_secret',
});
+isa_ok $api, 'Flickr::API';
my $rsp = $api->execute_method('fake.method', {});
+isa_ok $rsp, 'Flickr::API::Response';
##################################################
@@ -21,11 +25,11 @@ my $rsp = $api->execute_method('fake.method', {});
# check we get the 'method not found' error
#
-if ($rsp->{_rc} eq '200'){
+SKIP: {
+ skip "skipping error code check, since we couldn't reach the API", 1
+ if $rsp->{_rc} ne '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");
}
@@ -36,10 +40,10 @@ if ($rsp->{_rc} eq '200'){
$rsp = $api->execute_method('flickr.test.echo', {format => 'fake'});
-if ($rsp->{_rc} eq '200'){
+SKIP: {
+ skip "skipping error code check, since we couldn't reach the API", 1
+ if $rsp->{_rc} ne '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");
}
@@ -48,8 +52,8 @@ if ($rsp->{_rc} eq '200'){
# check the signing works properly
#
-ok('466cd24ced0b23df66809a4d2dad75f8' eq $api->sign_args({'foo' => 'bar'}), "Signing test 1");
-ok('f320caea573c1b74897a289f6919628c' eq $api->sign_args({'foo' => undef}), "Signing test 2");
+is($api->sign_args({'foo' => 'bar'}), '466cd24ced0b23df66809a4d2dad75f8', "Signing test 1");
+is($api->sign_args({'foo' => undef}), 'f320caea573c1b74897a289f6919628c', "Signing test 2");
$api->{unicode} = 0;
is('b8bac3b2a4f919d04821e43adf59288c', $api->sign_args({'foo' => "\xE5\x8C\x95\xE4\xB8\x83"}), "Signing test 3 (unicode=0)");
--
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