App-Zapzi
view release on metacpan or search on metacpan
t/04-fetch-article.t view on Meta::CPAN
ok( $f->fetch, 'Fetch sample URL' );
is( $f->fetcher, 'URL', 'Text file was handled by URL fetcher' );
like( $f->validated_source, qr|http://.*example|,
'URL source was set by fetcher' );
like( $f->text, qr/Example Domain/, 'Contents of test URL OK' );
like( $f->content_type, qr(text/html), 'Contents are HTML' );
$f = App::Zapzi::FetchArticle->new(source =>
'http://www.perl.com/nonesuch');
isa_ok( $f, 'App::Zapzi::FetchArticle' );
ok( ! $f->fetch, 'Detects URL 404' );
like( $f->error, qr/404/, 'Error reported' );
$f = App::Zapzi::FetchArticle->new(source =>
'http://999.999.999.999/foo');
isa_ok( $f, 'App::Zapzi::FetchArticle' );
ok( ! $f->fetch, 'Detects invalid host' );
like( $f->error, qr/Failed/, 'Error reported' );
$f = App::Zapzi::FetchArticle->new(source =>
'httpX://google.com/');
isa_ok( $f, 'App::Zapzi::FetchArticle' );
( run in 1.154 second using v1.01-cache-2.11-cpan-39bf76dae61 )