CGI-Application-Plugin-Authentication
view release on metacpan or search on metacpan
t/03_login_box_other.t view on Meta::CPAN
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;
subtest 'Various other pemutations' => sub {
plan tests => 1;
undef local $cap_options->{LOGIN_FORM}->{COMMENT};
local $cap_options->{LOGIN_FORM}->{FOCUS_FORM_ONLOAD} = 1;
local $cap_options->{LOGIN_FORM}->{REMEMBERUSER_OPTION} = 0;
local $cap_options->{LOGIN_FORM}->{REGISTER_URL} = '/register';
local $cap_options->{LOGIN_FORM}->{FORGOTPASSWORD_URL} = '/forgot';
local $cap_options->{LOGIN_FORM}->{GREY_COLOUR} = 'purple';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/other_permutations", "Other permutations");
};
subtest 'Percentage' => sub {
plan tests => 1;
local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = '20%';
local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = '10%';
local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = '80%';
local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = '90%';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/percentage", "Percentage");
};
subtest 'Names of colours' => sub {
plan tests => 1;
local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = '110%';
local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = 'red';
local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = 'green';
local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = 'blue';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/names_of_colours", "Names of colours");
};
subtest 'Names of colours II' => sub {
plan tests => 1;
local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = 'orange';
local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = 'red';
local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = '110%';
local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = 'blue';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/names_of_colours_2", "Names of colours");
};
subtest 'Names of colours III' => sub {
plan tests => 1;
local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = 'orange';
local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = 'red';
local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = 'purple';
local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = 'blue';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/names_of_colours_3", "Names of colours");
};
subtest 'grey' => sub {
plan tests => 1;
local $cap_options->{LOGIN_FORM}->{LIGHT_COLOUR} = 'orange';
local $cap_options->{LOGIN_FORM}->{LIGHTER_COLOUR} = '15%';
local $cap_options->{LOGIN_FORM}->{DARK_COLOUR} = 'purple';
local $cap_options->{LOGIN_FORM}->{DARKER_COLOUR} = 'blue';
local $cap_options->{LOGIN_FORM}->{GREY_COLOUR} = 'blue';
my $query = CGI->new( { rm => 'two'} );
my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
ok_regression(sub {make_output_timeless($cgiapp->run)}, "t/out/grey", "grey");
( run in 1.220 second using v1.01-cache-2.11-cpan-98e64b0badf )