Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (19 sloc) 0.769 kb
use warnings;
use strict;
use Test::More;
use lib qw(t/lib);
eval 'use TestUA';
plan skip_all => 'LWP::UserAgent 5.819 required for tests' if $@;
plan tests => 1;
use Net::Twitter;
# For end_session, on success, twitter returns status code 200 and an ERROR
# payload!!!
my $nt = Net::Twitter->new(ssl => 0, legacy => 0, username => 'me', password => 'secret');
my $t = TestUA->new(1, $nt->ua);
$t->response->content('{"error":"Logged out.","request":"/account/end_session.json"}');
# This test will always succeed since we're spoofing the response
# from Twitter. It's simply meant to demonstrate Twitter's behavior.
# Should we thorw an error, or should we return the HASH?
my $r = eval { $nt->end_session };
like $@, qr/Logged out/, 'error on success';
Jump to Line
Something went wrong with that request. Please try again.