diff options
Diffstat (limited to 'debian/perl-framework/t/modules/allowmethods.t')
-rw-r--r-- | debian/perl-framework/t/modules/allowmethods.t | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/debian/perl-framework/t/modules/allowmethods.t b/debian/perl-framework/t/modules/allowmethods.t index 6e2e815..d012554 100644 --- a/debian/perl-framework/t/modules/allowmethods.t +++ b/debian/perl-framework/t/modules/allowmethods.t @@ -9,6 +9,7 @@ my $r; my $get = "Get"; my $head = "Head"; my $post = "Post"; +my $options = "Options"; ## ## mod_allowmethods test @@ -25,11 +26,26 @@ my @test_cases = ( [ $post, $post, 200 ], ); +my @new_test_cases = ( + [ $get, $post . '/reset', 200 ], + [ $post, $get . '/post', 200 ], + [ $get, $get . '/post', 200 ], + [ $options, $get . '/post', 405 ], + [ $get, $get . '/none', 405 ], + [ $get, "NoPost", 200 ], + [ $post, "NoPost", 405 ], + [ $options, "NoPost" , 200 ], +); + +if (have_min_apache_version('2.5.1')) { + push(@test_cases, @new_test_cases); +} + plan tests => (scalar @test_cases), have_module 'allowmethods'; foreach my $case (@test_cases) { my ($fct, $allowed, $rc) = @{$case}; - + if ($fct eq $get) { $r = GET('/modules/allowmethods/' . $allowed . '/'); } @@ -39,7 +55,10 @@ foreach my $case (@test_cases) { elsif ($fct eq $post) { $r = POST('/modules/allowmethods/' . $allowed . '/foo.txt'); } + elsif ($fct eq $options) { + $r = OPTIONS('/modules/allowmethods/' . $allowed . '/'); + } - ok t_cmp($r->code, $rc, $fct . " - When " . $allowed . " is allowed."); + ok t_cmp($r->code, $rc, "$fct request to /$allowed responds $rc"); } - + |