Apache2-API
view release on metacpan or search on metacpan
t/lib/Test/Apache2/API/Request.pm view on Meta::CPAN
# satisfies
# script_filename
# script_name
# script_uri
# script_url
# Apache2::ServerUtil->server
sub server { return( shift->_test({ method => 'server', expect => 'Apache2::ServerRec', type => 'isa' }) ); }
# server_addr
# server_admin
# server_hostname
# server_name
# server_port
# server_protocol
# server_signature
# server_software
# server_version
# set_basic_credentials
# set_handlers
# slurp_filename
sub socket { return( shift->_test({ method => 'socket', expect => 'APR::Socket', type => 'isa' }) ); }
# status
# status_line
# str2datetime
# str2time
# subnet_of
sub subprocess_env { return( shift->_test({ method => 'subprocess_env', expect => 'APR::Table', type => 'isa' }) ); }
sub the_request { return( shift->_test({ method => 'the_request', expect => 'GET /tests/request/the_request HTTP/1.1' }) ); }
# time2datetime
# 2021-11-1T167:12:10+0900
sub time2str { return( shift->_test({ method => 'time2str', expect => 'Mon, 01 Nov 2021 08:12:10 GMT', args => [1635754330] }) ); }
sub type { return( shift->_test({ method => 'type', expect => 'text/plain' }) ); }
# unparsed_uri
# uploads
sub uri { return( shift->_test({ method => 'uri', expect => 'URI', type => 'isa' }) ); }
# url_decode
# url_encode
# user
sub user_agent { return( shift->_test({ method => 'user_agent', expect => 'Test-Apache2-API/v0.1.0' }) ); }
sub _target { return( shift->api->request ); }
1;
# NOTE: POD
# Use this to generate the tests list:
# egrep -E '^sub ' ./t/lib/Test/Apache2/API/Request.pm | perl -lnE 'my $m = [split(/\s+/, $_)]->[1]; say "=head2 $m\n"'
__END__
=encoding utf8
=head1 NAME
Test::Apache2::API::Request - Apache2::API::Request Testing Class
=head1 SYNOPSIS
my $hostport = Apache::TestRequest::hostport( $config ) || '';
my( $host, $port ) = split( ':', ( $hostport ) );
my $mp_host = 'www.example.org';
Apache::TestRequest::user_agent(reset => 1, keep_alive => 1 );
my $ua = Apache::TestRequest->new;
# To get the fingerprint for the certificate in ./t/server.crt, do:
# echo "sha1\$$(openssl x509 -noout -in ./t/server.crt -fingerprint -sha1|perl -pE 's/^.*Fingerprint=|(\w{2})(?:\:?|$)/$1/g')"
$ua->ssl_opts(
# SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
# SSL_verify_mode => 0x00
# verify_hostname => 0,
SSL_fingerprint => 'sha1$DEE8650E44870896E821AAE4A5A24382174D100E',
# SSL_version => 'SSLv3',
# SSL_verfifycn_name => 'localhost',
);
my $req = HTTP::Request->new( 'GET' => "${proto}://${hostport}/tests/request/some_method" );
my $resp = $ua->request( $req );
is( $resp->code, Apache2::Const::HTTP_OK, 'some test name' );
=head1 VERSION
v0.1.0
=head1 DESCRIPTION
This is a package for testing the L<Apache2::API> module under Apache2/modperl2 and inherits from C<Test::Apache::Common>
=head1 TESTS
=head2 aborted
=head2 accept
=head2 accept_charset
=head2 accept_encoding
=head2 accept_language
=head2 accept_type
=head2 accept_version
=head2 acceptable
=head2 acceptables
=head2 allowed
=head2 args
=head2 as_string
( run in 1.055 second using v1.01-cache-2.11-cpan-39bf76dae61 )