|
Lines 7-13
use CGI qw ( -utf8 );
Link Here
|
| 7 |
use Test::MockObject; |
7 |
use Test::MockObject; |
| 8 |
use Test::MockModule; |
8 |
use Test::MockModule; |
| 9 |
use List::MoreUtils qw/all any none/; |
9 |
use List::MoreUtils qw/all any none/; |
| 10 |
use Test::More tests => 20; |
10 |
use Test::More tests => 21; |
| 11 |
use Test::Warn; |
11 |
use Test::Warn; |
| 12 |
use t::lib::Mocks; |
12 |
use t::lib::Mocks; |
| 13 |
use t::lib::TestBuilder; |
13 |
use t::lib::TestBuilder; |
|
Lines 42-48
$schema->storage->txn_begin;
Link Here
|
| 42 |
|
42 |
|
| 43 |
subtest 'checkauth() tests' => sub { |
43 |
subtest 'checkauth() tests' => sub { |
| 44 |
|
44 |
|
| 45 |
plan tests => 9; |
45 |
plan tests => 10; |
| 46 |
|
46 |
|
| 47 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } }); |
47 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } }); |
| 48 |
|
48 |
|
|
Lines 110-120
subtest 'checkauth() tests' => sub {
Link Here
|
| 110 |
is( $userid, undef, 'If librarian user is used and password with GET, they should not be logged in' ); |
110 |
is( $userid, undef, 'If librarian user is used and password with GET, they should not be logged in' ); |
| 111 |
}; |
111 |
}; |
| 112 |
|
112 |
|
| 113 |
subtest 'Template params tests (password_expired)' => sub { |
113 |
subtest 'sessionID should be passed to the template for auth' => sub { |
| 114 |
|
114 |
|
| 115 |
plan tests => 1; |
115 |
plan tests => 1; |
| 116 |
|
116 |
|
| 117 |
my $password_expired; |
117 |
subtest 'hit auth.tt' => sub { |
|
|
118 |
|
| 119 |
plan tests => 1; |
| 120 |
|
| 121 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
| 122 |
|
| 123 |
my $password = set_weak_password($patron); |
| 124 |
|
| 125 |
my $cgi_mock = Test::MockModule->new('CGI'); |
| 126 |
$cgi_mock->mock( 'request_method', sub { return 'POST' } ); |
| 127 |
my $cgi = CGI->new; |
| 128 |
|
| 129 |
# Simulating the login form submission |
| 130 |
$cgi->param( 'userid', $patron->userid ); |
| 131 |
$cgi->param( 'password', $password ); |
| 132 |
|
| 133 |
my ( $userid, $cookie, $sessionID, $flags, $template ) = |
| 134 |
C4::Auth::checkauth( $cgi, 0, { catalogue => 1 }, 'intranet', undef, undef, { do_not_print => 1 } ); |
| 135 |
ok( $template->{VARS}->{sessionID} ); |
| 136 |
}; |
| 137 |
}; |
| 138 |
|
| 139 |
subtest 'Template params tests (password_expired)' => sub { |
| 140 |
|
| 141 |
plan tests => 1; |
| 118 |
|
142 |
|
| 119 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
143 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 120 |
|
144 |
|
| 121 |
- |
|
|