Skip to content

Commit

Permalink
t/05 is good now
Browse files Browse the repository at this point in the history
  • Loading branch information
clsung committed May 27, 2011
1 parent a7db745 commit 7d66d08
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions t/05-api_unreadcounts.t
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
#!perl -T

use Test::More tests => 6;
use Env qw(PLURKAPIKEY PLURKUSER PLURKPASS);
use Env qw(CONSUMER_KEY CONSUMER_SECRET ACCESS_TOKEN ACCESS_TOKEN_SECRET);
use Test::More;
if ($CONSUMER_KEY and $CONSUMER_SECRET) {
plan tests => 5;
} else {
plan skip_all =>
"You must set the following environment variables: \n".
"CONSUMER_KEY/CONSUMER_SECRET\n".
"ACCESS_TOKEN/ACCESS_TOKEN_SECRET\n";
}

BEGIN {
use Net::Plurk;
my $api_key = $PLURKAPIKEY // "dKkIdUCoHo7vUDPjd3zE0bRvdm5a9sQi";
my $user = $PLURKUSER // 'nobody';
my $pass = $PLURKPASS // 'nopass';
my $p = Net::Plurk->new(api_key => $api_key);
my $profile = $p->login(user => $user, pass => $pass );
is($p->is_logged_in(), 1);
my $json = $p->api( path => '/Polling/getUnreadCount');
my $key = $CONSUMER_KEY;
my $secret = $CONSUMER_SECRET;
my $token = $ACCESS_TOKEN;
my $token_secret = $ACCESS_TOKEN_SECRET;
my $p = Net::Plurk->new(consumer_key => $key, consumer_secret => $secret);
$p->authorize(token => $token, token_secret => $token_secret);
my $json = $p->callAPI( '/Polling/getUnreadCount');
isa_ok ($json, HASH);
cmp_ok( $json->{all}, '>=', 0);
cmp_ok( $json->{my}, '>=', 0);
Expand Down

0 comments on commit 7d66d08

Please sign in to comment.