Mailing List Archive

svn commit: r1893389 - in /httpd/test/framework/trunk/t: conf/extra.conf.in htdocs/modules/actions/ htdocs/modules/actions/action/ htdocs/modules/actions/script/ modules/actions.t
Author: jailletc36
Date: Thu Sep 16 20:52:26 2021
New Revision: 1893389

URL: http://svn.apache.org/viewvc?rev=1893389&view=rev
Log:
Add tests for_mod_actions.

Other eyes on the relevance of the tests and on my perl syntax welcomed

Added:
httpd/test/framework/trunk/t/htdocs/modules/actions/
httpd/test/framework/trunk/t/htdocs/modules/actions/action/
httpd/test/framework/trunk/t/htdocs/modules/actions/script/
httpd/test/framework/trunk/t/modules/actions.t
Modified:
httpd/test/framework/trunk/t/conf/extra.conf.in

Modified: httpd/test/framework/trunk/t/conf/extra.conf.in
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1893389&r1=1893388&r2=1893389&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Thu Sep 16 20:52:26 2021
@@ -1411,3 +1411,23 @@ LimitRequestFields 32
CheckCaseOnly on
</Directory>
</IfModule>
+
+<IfModule mod_actions.c>
+ ScriptAlias /cgi_mod_actions @SERVERROOT@/htdocs/modules/cgi
+ <Location /mod_actions>
+ SetHandler my-handler
+ Action my-handler "/cgi_mod_actions/perl_echo.pl" virtual
+ </Location>
+
+ <Directory @SERVERROOT@/htdocs/modules/actions/action>
+ AddHandler my-file-type1 .xyz1
+ Action my-file-type1 "/cgi_mod_actions/perl_echo.pl"
+ AddHandler my-file-type2 .xyz2
+ Action my-file-type2 "/cgi_mod_actions/perl_echo.pl" virtual
+ </Directory>
+
+ <Directory @SERVERROOT@/htdocs/modules/actions/script>
+ Script GET "/cgi_mod_actions/perl_echo.pl"
+ Script POST "/cgi_mod_actions/perl_post.pl"
+ </Directory>
+</IfModule>

Added: httpd/test/framework/trunk/t/modules/actions.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/actions.t?rev=1893389&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/modules/actions.t (added)
+++ httpd/test/framework/trunk/t/modules/actions.t Thu Sep 16 20:52:26 2021
@@ -0,0 +1,59 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+
+##
+## mod_action tests
+##
+my @tests_action = (
+ [ "mod_actions/", 200, "nada"], # Handler for this location
+
+ [ "modules/actions/action/test.xyz", 404], # No handler for .xyz
+ [ "modules/actions/action/test.xyz1", 404], # Handler for .xyz1, but not virtual
+ [ "modules/actions/action/test.xyz22", 404], # No Handler for .xyz2x (but one for .xyz2)
+
+ [ "modules/actions/action/test.xyz2", 200, "nada"], # Handler for .xyz2, and virtual
+);
+
+my @tests_script = (
+ [ "modules/actions/script/test.x", 404],
+ [ "modules/actions/script/test.x?foo=bar", 200, "foo=bar"],
+);
+
+my $r;
+
+plan tests => scalar @tests_action*2 + scalar @tests_script*(2+2+1), need_module('actions');
+
+foreach my $test (@tests_action) {
+ $r = GET($test->[0]);
+ ok t_cmp($r->code, $test->[1]);
+ if ($test->[1] == 200) {
+ ok t_cmp($r->content, $test->[2]);
+ }
+ else {
+ skip "RC=404, no need to check content", 1;
+ }
+}
+
+foreach my $test (@tests_script) {
+ $r = GET($test->[0]);
+ ok t_cmp($r->code, $test->[1]);
+ if ($test->[1] == 200) {
+ ok t_cmp($r->content, $test->[2]);
+ }
+ else {
+ skip "RC=404, no need to check content", 1;
+ }
+
+ $r = POST($test->[0], content => "foo2=bar2");
+ ok t_cmp($r->code, 200);
+ ok t_cmp($r->content, "POST\nfoo2: bar2\n");
+
+ # Method not allowed
+ $r = PUT($test->[0], content => "foo2=bar2");
+ ok t_cmp($r->code, 405);
+}
+