Skip to content

Commit

Permalink
Verify OPTIONS give 405 status
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 15, 2024
1 parent 128a111 commit 3deec0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
16 changes: 5 additions & 11 deletions t/modules-used.t
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#!perl -w

use strict;
use Test::Most;

unless($ENV{'AUTHOR_TESTING'}) {
plan(skip_all => 'Author tests not required for installation');
}
use Test::DescribeMe qw(author);
use Test::Most;
use Test::Needs 'Test::Module::Used';

eval 'use Test::Module::Used';
if($@) {
plan(skip_all => 'Test::Module::Used required for testing all modules needed');
} else {
my $used = Test::Module::Used->new(meta_file => 'MYMETA.yml');
$used->ok();
}
my $used = Test::Module::Used->new(meta_file => 'MYMETA.yml');
$used->ok();
16 changes: 4 additions & 12 deletions t/namespaces.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@

use strict;
use warnings;

use Test::DescribeMe qw(author);
use Test::Most;
use Test::Needs 'Test::CleanNamespaces';

if($ENV{'AUTHOR_TESTING'}) {
eval {
require Test::CleanNamespaces;
};
if($@) {
plan(skip_all => 'Test::CleanNamespaces not installed');
} else {
Test::CleanNamespaces->all_namespaces_clean();
}
} else {
plan(skip_all => "Author tests not required for installation");
}
Test::CleanNamespaces->all_namespaces_clean();
7 changes: 5 additions & 2 deletions t/status.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

use strict;
use warnings;
use Test::Most tests => 10;
use Test::Most tests => 12;
use Test::NoWarnings;

BEGIN {
use_ok('CGI::Info');
}

PARAMS: {
STATUS: {
$ENV{'GATEWAY_INTERFACE'} = 'CGI/1.1';
$ENV{'REQUEST_METHOD'} = 'GET';
$ENV{'QUERY_STRING'} = 'foo=bar';
Expand All @@ -25,4 +25,7 @@ PARAMS: {

$ENV{'REQUEST_METHOD'} = 'POST';
is(new_ok('CGI::Info')->status(), 411, 'Notify that CONTENT_LENGTH is needed for POST');

$ENV{'REQUEST_METHOD'} = 'OPTIONS';
cmp_ok(new_ok('CGI::Info')->status(), '==', 405, "Notify that OPTIONS isn't suported");
}

0 comments on commit 3deec0e

Please sign in to comment.