You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by ge...@apache.org on 2004/04/12 17:12:43 UTC

cvs commit: httpd-test/perl-framework/t/conf extra.conf.in

geoff       2004/04/12 08:12:43

  Modified:    perl-framework/t/conf extra.conf.in
  Added:       perl-framework/t/apache errordoc.t
  Log:
  added simple ErrorDocument tests
  
  Revision  Changes    Path
  1.1                  httpd-test/perl-framework/t/apache/errordoc.t
  
  Index: errordoc.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  Apache::TestRequest::module('error_document');
  
  plan tests => 14, have_lwp;
  
  # basic ErrorDocument tests
  
  {
      my $response = GET '/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               'notfound.html code');
  
      ok t_cmp(qr'per-server 404',
               $content,
               'notfound.html content');
  }
  
  {
      my $response = GET '/inherit/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/inherit/notfound.html code');
  
      ok t_cmp(qr'per-server 404',
               $content,
               '/inherit/notfound.html content');
  }
  
  {
      my $response = GET '/redefine/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/redefine/notfound.html code');
  
      ok t_cmp('per-dir 404',
               $content,
               '/redefine/notfound.html content');
  }
  
  {
      my $response = GET '/restore/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/redefine/notfound.html code');
  
      # 1.3 requires quotes for hard-coded messages
      my $expected = have_min_apache_version('2.1') ? qr/Not Found/ : 
                     have_apache(2)                 ? 'default'     :
                     qr/Additionally, a 500/;
  
      ok t_cmp($expected,
               $content,
               '/redefine/notfound.html content');
  }
  
  {
      my $response = GET '/apache/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/merge/notfound.html code');
  
      ok t_cmp('testing merge',
               $content,
               '/merge/notfound.html content');
  }
  
  {
      my $response = GET '/apache/etag/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/merge/merge2/notfound.html code');
  
      ok t_cmp('testing merge',
               $content,
               '/merge/merge2/notfound.html content');
  }
  
  {
      my $response = GET '/bounce/notfound.html';
      chomp(my $content = $response->content);
  
      ok t_cmp(404,
               $response->code,
               '/bounce/notfound.html code');
  
      ok t_cmp(qr!expire test!,
               $content,
               '/bounce/notfound.html content');
  }
  
  
  
  1.47      +36 -0     httpd-test/perl-framework/t/conf/extra.conf.in
  
  Index: extra.conf.in
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/conf/extra.conf.in,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- extra.conf.in	28 Feb 2004 21:49:54 -0000	1.46
  +++ extra.conf.in	12 Apr 2004 15:12:42 -0000	1.47
  @@ -364,3 +364,39 @@
           </Location>
       </IfModule>
   </IfDefine>
  +
  +##
  +## ErrorDocument handling
  +## create it's own virtual host so it doesn't interfere
  +## with other tests for 404 messages
  +## 
  +<VirtualHost _default_:error_document>
  +    ErrorDocument 404 "per-server 404
  +                                                                                                                             
  +    <Location /redefine>
  +        ErrorDocument 404 "per-dir 404
  +    </Location>
  +                                                                                                                             
  +    <Location /inherit>
  +        # nothing here
  +    </Location>
  +
  +    <Location /bounce>
  +        ErrorDocument 404 /modules/expires/expire.html
  +    </Location>
  +
  +    <Location /restore>
  +        # special "default" value = restore canned error response
  +        ErrorDocument 404 default
  +    </Location>
  +
  +    <Directory @DocumentRoot@/apache>
  +         ErrorDocument 404 "testing merge
  +    </Directory>
  +                                                                                                                             
  +    <Directory @DocumentRoot@/apache/etag>
  +         # 404 should be inherited from /apache
  +         ErrorDocument 500 "hmph
  +    </Directory>
  +
  +</VirtualHost>