SYNOPSIS
use WebAuth::Tests qw(build_page);
my %settings = (
test_number => 1,
test_desc => 'basic WebAuth test',
extended_desc => \@extended,
);
print "Content-type: text/html\n\n";
print build_page(\%settings);
DESCRIPTION
This module provides shared code for the test suite for the mod_webauth Apache module. It is used by the individual test programs and test Apache configuration to construct a variety of scenarios to exercise most of the functionality of mod_webauth and some of the WebLogin and mod_webkdc features. Most of the test setup is in the Apache configuration, but each test corresponds to a Perl script, which uses this module, that checks environment variables to see that the tests did what they should and provides useful debugging information if they did not.This module is primarily intended for use with the tests that are included with WebAuth and currently includes some defaults that make it difficult to use for other purposes. The goal is to eventually make it more general so that it can be used for building additional tests local to a particular site.
FUNCTIONS
None of the following functions are exported by default. They must be explicitly requested when using the WebAuth::Tests module.- build_page(SETTINGS)
-
Performs the work of building a test page that shows the test number,
title, information about the test run, and various tables showing current
status and tests run. SETTINGS should be a reference to a hash, which may
contain one or more of the following settings:
-
- test_number
- The number of this test, passed to the template.
- test_desc
- The short description of this test, passed to the template.
- extended_description
- The extended description of this test. This should be a reference to an array that contains one or more paragraphs of text as strings. Each element of the array will be wrapped in <p> tags.
- extra_tests
- An anonymous array of hash references, each of which represents a test result. The hash should have three keys: "name", "result", and "comment". "name" should be the name of this test, "result" should be either "PASS" or "FAIL", and "comment" should provide additional information about the test.
- extra_tests_title
- If there are extra tests, this will be used as the heading for that test output. If this setting is present, extra_tests should also be present.
- multifactor
- Set this to true to also perform multifactor tests.
- template
- The path (possibly relative) to the template used for generating HTML. By default, this is set to ../test.tt2, which works for the default mod_webauth test suite (and probably not for anything else).
- unauth_loc
- Set this to true if this test will be running without authentication. This is used by the template to change some of the boilerplate text.
-
- run_test(NAME, RESULT, GOOD, BAD, BOLD)
- Performs a test of WebAuth information, returning an anonymous hash showing the results of the test in the format required by the "extra_tests" setting to build_page(). It takes the name of the test, a boolean value that represents the result of the test, text to display on true or false results, and a flag indicating whether to bold true results.
- app_lifetime_test
- Creates an anonymous array of hash references that contains the results of a test for the lifetime of an application token. The result is suitable for inclusion in "extra_tests".
- last_used_test()
- Creates an anonymous array of hash references that contains the results of a test for current last-used time for a token. The result is suitable for inclusion in "extra_tests".
BUGS
The interactions between this module and its template aren't currently completely documented.No one has yet used this module for anything other than the mod_webauth test suite included in the distribution. It will probably need work to be usable for writing site-specific tests.