From: <pau...@us...> - 2008-03-08 10:47:38
|
Revision: 990 http://everydevel.svn.sourceforge.net/everydevel/?rev=990&view=rev Author: paul_the_nomad Date: 2008-03-08 02:47:35 -0800 (Sat, 08 Mar 2008) Log Message: ----------- Apache tests using the Apache::Test module. Only runs if correct apache is running. Currently only does some url tests. Modified Paths: -------------- trunk/ebase/Build.PL Added Paths: ----------- trunk/ebase/t/TEST trunk/ebase/t/apache-server/ trunk/ebase/t/apache-server/url.t trunk/ebase/t/conf/ trunk/ebase/t/conf/extra.conf.in Modified: trunk/ebase/Build.PL =================================================================== --- trunk/ebase/Build.PL 2008-03-08 10:47:16 UTC (rev 989) +++ trunk/ebase/Build.PL 2008-03-08 10:47:35 UTC (rev 990) @@ -49,7 +49,8 @@ 'Test::Warn' => 0.10, 'Test::Exception' => 0.13, 'Test::Simple' => 0.47, - 'Template' => 0, + 'Template' => 0, + 'Proc::ProcessTable' => 0, }, scripts => [ File::Spec->catfile( 'bin', 'nbmasta' ) ], test_files => join( ' ', @test_files ), Added: trunk/ebase/t/TEST =================================================================== --- trunk/ebase/t/TEST (rev 0) +++ trunk/ebase/t/TEST 2008-03-08 10:47:35 UTC (rev 990) @@ -0,0 +1,7 @@ +#!/usr/bin/perl + +use Apache::TestRun; +use strict; +use warnings; + +Apache::TestRun->new->run( @ARGV ); Property changes on: trunk/ebase/t/TEST ___________________________________________________________________ Name: svn:executable + * Added: trunk/ebase/t/apache-server/url.t =================================================================== --- trunk/ebase/t/apache-server/url.t (rev 0) +++ trunk/ebase/t/apache-server/url.t 2008-03-08 10:47:35 UTC (rev 990) @@ -0,0 +1,43 @@ + +BEGIN { + require 'Test/More.pm'; + if ( !-e 't/conf/httpd.conf' ) { + Test::More->import( + skip_all => 'Needs proper apache configuration to run.' ); + } +} + +use Apache::Test '-withtestmore'; +use Apache::TestRequest qw(GET); +use Apache::TestUtil; +use Apache2::Const ':common'; +use Proc::ProcessTable; + +use strict; +use warnings; + +my $table = Proc::ProcessTable->new; +my $conf_file = Apache::Test::vars->{t_conf}; +my $flag = + grep { /.*apache.*$conf_file/ } map { $_->cmndline } @{ $table->table }; + +plan + tests => 4, + need { + "Correct apache process must be running." => sub { $flag } + }; + +my $response = GET '/'; +ok( $response->is_success, '...root directory should return OK.' ); + +$response = GET '/nonsense/url'; +ok( $response->code == NOT_FOUND, "...doesn't find a non-existing url." ); + +$response = GET '/?node_id=1'; +ok( $response->is_success, '...if we ask for node 1, get OK response.' ); + +# test simple +$response = GET '/node/1'; +ok( $response->is_success, + '...if we ask for node 1 with url schema, get OK response.' ); + Added: trunk/ebase/t/conf/extra.conf.in =================================================================== --- trunk/ebase/t/conf/extra.conf.in (rev 0) +++ trunk/ebase/t/conf/extra.conf.in 2008-03-08 10:47:35 UTC (rev 990) @@ -0,0 +1,12 @@ +<Perl> +use lib '@SERVERROOT@/../lib'; +</Perl> + +SetHandler perl-script +PerlSetVar everything-database @SERVERROOT@/ecore.db +PerlSetVar everything-database-options dbtype +PerlAddVar everything-database-options sqlite +PerlResponseHandler +Everything::HTTP::Apache + +PerlSetVar everything-url /node/:node_id +PerlAddVar everything-url node \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |