X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flive%2Fcomputers4sure.t;fp=dev%2Farm%2Flibwww-mechanize-perl%2Flibwww-mechanize-perl-1.34%2Ft%2Flive%2Fcomputers4sure.t;h=fc77630c19b29aa6507b263d533082b7fc022629;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/live/computers4sure.t b/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/live/computers4sure.t new file mode 100644 index 0000000..fc77630 --- /dev/null +++ b/dev/arm/libwww-mechanize-perl/libwww-mechanize-perl-1.34/t/live/computers4sure.t @@ -0,0 +1,48 @@ +#!perl -T + +use warnings; +use strict; + +if ($ENV{NOINTERNET} ) { + use Test::More skip_all => "We don't have internet here"; +} + +use Test::More skip_all => 'Still need to get the error-handling on here working'; +use Test::More tests => 9; + +BEGIN { + use_ok( 'WWW::Mechanize' ); +} + +# XXX We need tests in here to verify that we're asking for gzip output + +my $mech = WWW::Mechanize->new; +isa_ok( $mech, 'WWW::Mechanize', 'Created object' ); +$mech->agent_alias( 'Linux Mozilla' ); + +my $first_page = 'http://www.computers4sure.com/'; +$mech->get( $first_page ); +is( $mech->response->code, 200, "Fetched $first_page" ); +ok( $mech->content =~ /Support/, 'Found a likely word in the first page' ); + +my @links = $mech->find_all_links( url_regex => qr{product\.asp\?productid=} ); +cmp_ok( scalar @links, '>', 10, 'Should have lots of product links' ); + +my $link = $links[@links/2]; # Pick one in the middle +isa_ok( $link, 'WWW::Mechanize::Link' ); +my $link_str = $link->url; + +# The problem we're having is that the 2nd get, following a link, +# comes back gzipped. +$mech->get( $link_str ); +is( $mech->response->code, 200, "Fetched $link_str" ); +ok( $mech->content =~ /Your price/i, 'Found a likely phrase in the second page' ); +#print $mech->content; + +SKIP: { + eval 'use Test::Memory::Cycle'; + skip 'Test::Memory::Cycle not installed', 1 if $@; + + memory_cycle_ok( $mech, 'No memory cycles found' ); +} +