Lines 9-14
Link Here
|
9 |
my $get = "Get"; |
9 |
my $get = "Get"; |
10 |
my $head = "Head"; |
10 |
my $head = "Head"; |
11 |
my $post = "Post"; |
11 |
my $post = "Post"; |
|
|
12 |
my $options = "Options"; |
12 |
|
13 |
|
13 |
## |
14 |
## |
14 |
## mod_allowmethods test |
15 |
## mod_allowmethods test |
Lines 15-20
Link Here
|
15 |
## |
16 |
## |
16 |
my @test_cases = ( |
17 |
my @test_cases = ( |
17 |
[ $get, $get, 200 ], |
18 |
[ $get, $get, 200 ], |
|
|
19 |
[ $get, "NoPost", 200 ], |
20 |
[ $post, "NoPost", 405 ], |
21 |
[ $options, "NoPost" , 200 ], |
18 |
[ $head, $get, 200 ], |
22 |
[ $head, $get, 200 ], |
19 |
[ $post, $get, 405 ], |
23 |
[ $post, $get, 405 ], |
20 |
[ $get, $head, 200 ], |
24 |
[ $get, $head, 200 ], |
Lines 24-29
Link Here
|
24 |
[ $head, $post, 405 ], |
28 |
[ $head, $post, 405 ], |
25 |
[ $post, $post, 200 ], |
29 |
[ $post, $post, 200 ], |
26 |
[ $get, $post . '/reset', 200 ], |
30 |
[ $get, $post . '/reset', 200 ], |
|
|
31 |
[ $post, $get . '/post', 200 ], |
32 |
[ $get, $get . '/post', 200 ], |
33 |
[ $options, $get . '/post', 405 ], |
34 |
[ $get, $get . '/none', 405 ], |
27 |
); |
35 |
); |
28 |
|
36 |
|
29 |
plan tests => (scalar @test_cases), have_module 'allowmethods'; |
37 |
plan tests => (scalar @test_cases), have_module 'allowmethods'; |
Lines 30-36
Link Here
|
30 |
|
38 |
|
31 |
foreach my $case (@test_cases) { |
39 |
foreach my $case (@test_cases) { |
32 |
my ($fct, $allowed, $rc) = @{$case}; |
40 |
my ($fct, $allowed, $rc) = @{$case}; |
33 |
|
41 |
|
34 |
if ($fct eq $get) { |
42 |
if ($fct eq $get) { |
35 |
$r = GET('/modules/allowmethods/' . $allowed . '/'); |
43 |
$r = GET('/modules/allowmethods/' . $allowed . '/'); |
36 |
} |
44 |
} |
Lines 40-46
Link Here
|
40 |
elsif ($fct eq $post) { |
48 |
elsif ($fct eq $post) { |
41 |
$r = POST('/modules/allowmethods/' . $allowed . '/foo.txt'); |
49 |
$r = POST('/modules/allowmethods/' . $allowed . '/foo.txt'); |
42 |
} |
50 |
} |
|
|
51 |
elsif ($fct eq $options) { |
52 |
$r = OPTIONS('/modules/allowmethods/' . $allowed . '/'); |
53 |
} |
43 |
|
54 |
|
44 |
ok t_cmp($r->code, $rc, $fct . " - When " . $allowed . " is allowed."); |
55 |
ok t_cmp($r->code, $rc, "$fct request to /$allowed responds $rc"); |
45 |
} |
56 |
} |
46 |
|
57 |
|