From: <pau...@us...> - 2007-05-22 23:15:54
|
Revision: 964 http://svn.sourceforge.net/everydevel/?rev=964&view=rev Author: paul_the_nomad Date: 2007-05-22 16:15:52 -0700 (Tue, 22 May 2007) Log Message: ----------- HTML tests for an everything installation Added Paths: ----------- trunk/ebase/bin/html-server-test.pl Property Changed: ---------------- trunk/ebase/ Property changes on: trunk/ebase ___________________________________________________________________ Name: svk:merge - 16c2b9cb-492b-4d64-9535-64d4e875048d:/wip/ebase:997 a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:17930 + 16c2b9cb-492b-4d64-9535-64d4e875048d:/wip/ebase:998 a6810612-c0f9-0310-9d3e-a9e4af8c5745:/ebase/offline:17930 Added: trunk/ebase/bin/html-server-test.pl =================================================================== --- trunk/ebase/bin/html-server-test.pl (rev 0) +++ trunk/ebase/bin/html-server-test.pl 2007-05-22 23:15:52 UTC (rev 964) @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Carp qw/croak confess cluck/; +use Everything::CmdLine qw/abs_path get_options make_nodebase/; +use Everything::Test::Ecore::SimpleServer; +use Test::More; +use WWW::Mechanize; +use HTML::Lint; + +$SIG{__DIE__} =\&confess; +#$SIG{__WARN__} =\&cluck; + +$|++; + +my $opts = get_options( undef, [ 'listenport=i'] ); +my $nb = make_nodebase( $opts ); + +my $nodes = $nb->getNodeWhere(); + +my $num_nodes = scalar @$nodes; + +plan tests => $num_nodes * 2; + +$$opts{type} ||= 'sqlite'; +$$opts{listenport} ||= 8080; + +my $server = Everything::Test::Ecore::SimpleServer->new( { mod_perlInit => ["$$opts{database}:$$opts{user}:$$opts{password}:$$opts{host}", { dbtype => $$opts{type}} ], listenport => $$opts{'listenport'} } ); + +my $pid = $server->background; + +croak "Server won't start" unless $pid; + +my $base_url = "http://localhost:$$opts{'listenport'}"; + +my $mech = WWW::Mechanize->new; + +for (1..$num_nodes) { + my $url = $base_url . "?node_id=$_"; + my $r = $mech->get ( $url ); + my $lint = HTML::Lint->new; + ok ($r->is_success, "...successfully retrieved node id $_.") || diag "Error fetching $url\n" . $r->status_line; + $lint->parse( $r->content ); + is( scalar $lint->errors, 0, "...the HTML produced for node id $_ has no errors.") + || + do { + diag $_->as_string foreach $lint->errors; + diag $r->content; + exit; + }; +} + +kill 9, $pid; Property changes on: trunk/ebase/bin/html-server-test.pl ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |