CGI-Application-Plugin-Authentication
view release on metacpan or search on metacpan
t/50_driver_undefined.t view on Meta::CPAN
#!/usr/bin/perl -T
use Test::More;
use Test::Taint;
use Test::Exception;
use Test::Regression;
use English qw(-no_match_vars);
use lib qw(t);
if ($OSNAME eq 'MSWin32') {
my $msg = 'Not running these tests on windows yet';
plan skip_all => $msg;
}
plan tests => 46;
srand(0);
use strict;
use warnings;
taint_checking_ok('taint checking is on');
use CGI ();
my $cap_options = {
STORE => [
'Cookie',
SECRET => "Shhh, don't tell anyone",
NAME => 'CAPAUTH_DATA',
EXPIRY => '+1y'
],
};
{
package TestAppAuthenticate;
use base qw(CGI::Application);
use CGI::Application::Plugin::Authentication;
sub setup {
my $self = shift;
$self->start_mode('one');
$self->run_modes( [qw(one two three)] );
$self->authen->protected_runmodes(qw(two three));
$self->authen->config($cap_options);
}
sub one {
my $self = shift;
return "<html><body>ONE</body></html>";
}
sub two {
my $self = shift;
return "<html><body>TWO</body></html>";
}
sub three {
my $self = shift;
return "<html><body>THREE</body></html>";
}
sub post_login {
my $self = shift;
my $count = $self->param('post_login') || 0;
$self->param( 'post_login' => $count + 1 );
}
}
$ENV{CGI_APP_RETURN_ONLY} = 1;
# Test 'find_options' function and what happens when we don't define 'verify_credentials'
{
local $cap_options->{DRIVER} = [
'Silly',
option1 => 'Tom',
option2 => 'Dick',
option3 => 'Harry'
];
my $query = CGI->new(
{
authen_username => 'user1',
rm => 'two',
authen_password => '123',
( run in 0.344 second using v1.01-cache-2.11-cpan-d7f47b0818f )