Code:DoSIAL.t
From BioPerl
use strict; use Test::More tests => 13; use_ok('DoSIAL'); use_ok('LWP::UserAgent'); ok( my $sial = DoSIAL->new(), "make DoSIAL object" ); can_ok($sial, 'paste'); ok( $sial->paste('some stuff', 'majensen', 'testing DoSIAL'), "do a paste" ); ok( my $ua = LWP::UserAgent->new(), 'make a test UA' ); ok( my $get = $ua->get($sial->paste_url), 'GET with the returned url' ); ok( $get->is_success, 'roundtrip ok' ); like( $get->content, qr/some stuff/, 'content is present'); # test some fails $sial->paste('', ''); like( $sial->warn, qr/No data provided/, 'warn populated on no data' ); like( $sial->fail, qr/Nickname/, 'fail without nick' ); $sial->paste('some stuff', '\$me'); like( $sial->fail, qr/Bad char/, 'fail on tainted nick' ); $sial->paste('some stuff', 'me', '\$summary'); like( $sial->fail, qr/Bad char/, 'fail on tainted summary' );