Flickr-API

 view release on metacpan or  search on metacpan

t/06-oauth-authenticated-methods.t  view on Meta::CPAN

        qr/^[0-9a-f]+$/i,
        "Did we get an access_token token_secret from $config_file"
    );

    my $proceed = 0;

    if ($api->{oauth}->{token} =~ m/^[0-9]+-[0-9a-f]+$/i and
            $api->{oauth}->{token_secret} =~ m/^[0-9a-f]+$/i) {

        $proceed = 1;
    }

  SKIP: {

        skip "Skipping authentication tests, oauth access token seems wrong", 9
            if $proceed == 0;

        my $rsp = $api->execute_method('flickr.auth.oauth.checkToken');
        my $ref = $rsp->as_hash();

        is(
            $ref->{stat},
            'ok',
            'Did flickr.auth.oauth.checkToken complete sucessfully'
        );

        isnt(
            $ref->{oauth}->{user}->{nsid},
            undef,
            'Did flickr.auth.oauth.checkToken return nsid'
        );

        isnt(
            $ref->{oauth}->{user}->{username},
            undef,
            'Did flickr.auth.oauth.checkToken return username'
        );

        $rsp = $api->execute_method('flickr.test.login');
        $ref = $rsp->as_hash();

        is(
            $ref->{stat},
            'ok',
            'Did flickr.test.login complete sucessfully'
        );

        isnt(
            $ref->{user}->{id},
            undef,
            'Did flickr.test.login return id'
        );

        isnt(
            $ref->{user}->{username},
            undef,
            'Did flickr.test.login return username'
        );


        $rsp = $api->execute_method('flickr.prefs.getPrivacy');
        $ref = $rsp->as_hash;

        is(
            $ref->{stat},
            'ok',
            'Did flickr.prefs.getPrivacy complete sucessfully'
        );

        isnt(
            $ref->{person}->{nsid},
            undef,
            'Did flickr.prefs.getPrivacy return nsid'
        );

        isnt(
            $ref->{person}->{privacy},
            undef,
            'Did flickr.prefs.getPrivacy return privacy'
        );

    }
}


exit;

__END__


# Local Variables:
# mode: Perl
# End:



( run in 1.078 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )