1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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('mod_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);
}
|