Bug 36092: Add test
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
parent
c37c1361fb
commit
992c250628
|
|
@ -41,7 +41,7 @@ $schema->storage->txn_begin;
|
|||
|
||||
subtest 'checkauth() tests' => sub {
|
||||
|
||||
plan tests => 9;
|
||||
plan tests => 10;
|
||||
|
||||
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } });
|
||||
|
||||
|
|
@ -141,11 +141,35 @@ subtest 'checkauth() tests' => sub {
|
|||
};
|
||||
|
||||
|
||||
subtest 'Template params tests (password_expired)' => sub {
|
||||
subtest 'sessionID should be passed to the template for auth' => sub {
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
my $password_expired;
|
||||
subtest 'hit auth.tt' => sub {
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } );
|
||||
|
||||
my $password = set_weak_password($patron);
|
||||
|
||||
my $cgi_mock = Test::MockModule->new('CGI');
|
||||
$cgi_mock->mock( 'request_method', sub { return 'POST' } );
|
||||
my $cgi = CGI->new;
|
||||
|
||||
# Simulating the login form submission
|
||||
$cgi->param( 'userid', $patron->userid );
|
||||
$cgi->param( 'password', $password );
|
||||
|
||||
my ( $userid, $cookie, $sessionID, $flags, $template ) =
|
||||
C4::Auth::checkauth( $cgi, 0, { catalogue => 1 }, 'intranet', undef, undef, { do_not_print => 1 } );
|
||||
ok( $template->{VARS}->{sessionID} );
|
||||
};
|
||||
};
|
||||
|
||||
subtest 'Template params tests (password_expired)' => sub {
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
my $patron_class = Test::MockModule->new('Koha::Patron');
|
||||
$patron_class->mock( 'password_expired', sub { return $password_expired; } );
|
||||
|
|
|
|||
Loading…
Reference in New Issue