NAME

Test::Apache2::API - Apache2::API Testing Class

SYNOPSIS

In the Apache test conf:

PerlModule Apache2::API
PerlOptions +GlobalRequest
PerlSetupEnv On
<Directory "@documentroot@">
    SetHandler modperl
    PerlResponseHandler Test::Apache2::API
    AcceptPathInfo On
</Directory>

In the test unit:

use Apache::Test;
use Apache::TestRequest;
use HTTP::Request;

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/api/some_method" );
my $resp = $ua->request( $req );
is( $resp->code, Apache2::Const::HTTP_OK, 'some test name' );

VERSION

v0.1.0

DESCRIPTION

This is a package for testing the Apache2::API module under Apache2/modperl2

TESTS

The following tests are performed:

compression_threshold

decode_json

encode_decode_url

auth

header_datetime

is_perl_option_enabled

json

reply

server

server_version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Apache2::API, Apache::Test, Apache::TestUtil, Apache::TestRequest

COPYRIGHT & LICENSE

Copyright (c) 2019-2023 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.