The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!perl
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';