HTTP-DAV
view release on metacpan or search on metacpan
t/TestDetails.pm view on Meta::CPAN
# $Id$
package TestDetails;
use strict;
use Test;
use Exporter;
use Cwd;
use vars qw(@EXPORT @EXPORT_OK $VERSION @ISA);
@ISA=qw(Exporter);
@EXPORT=qw(do_test fail_tests test_callback $test_user $test_pass $test_url $test_cwd);
# This package is designed to simplify testing.
# It allows you to enter multiple URL's (and
# credentials) for the different tests.
# You need to manually edit the %details hash below.
# A test script may tell us that it is about to do a propfind.
# It would do this by calling TestDetails::method('PROPFIND');
# Then when the test script calls TestDetails::url() you will
# get the URL specificed in the PROPFIND hash below.
# But, if you haven't specified any details in the hash below
# specific for PROPFIND it will use the DEFAULT entries instead.
$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
# Configure these details:
my %details = (
# 'default' => {
# 'url'=> 'http://localhost/dav/',
# 'user' => 'username',
# 'pass' => 'pass',
# },
);
# End of configuration section
######################################################################
my $method = "";
my $PERLDAV_TEST = 'default';
if (defined $ENV{'PERLDAV_TEST'}) {
$PERLDAV_TEST = lc $ENV{'PERLDAV_TEST'} || 'default';
}
our $test_user = user();
our $test_pass = pass();
our $test_url = url();
our $test_cwd = getcwd(); # If the user wants to remember where they started.
######################################################################
sub fail_tests {
my ($num) = @_;
print "You need to set a test url in the t/TestDetails.pm module.\n";
for(1..$num) { skip("no test server",1); }
exit;
}
sub user {
no warnings;
$details{$PERLDAV_TEST}{'user'} ||
$details{'DEFAULT'}{'user'} ||
''
}
sub pass {
no warnings;
$details{$PERLDAV_TEST}{'pass'} ||
$details{'DEFAULT'}{'pass'} ||
''
}
sub url {
no warnings;
( run in 1.995 second using v1.01-cache-2.11-cpan-39bf76dae61 )