Bug 14408: Add tests to get_template_and_user
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
5a7f459290
commit
5dd7c8f0d5
1 changed files with 23 additions and 1 deletions
|
@ -8,7 +8,8 @@ use Modern::Perl;
|
||||||
use CGI qw ( -utf8 );
|
use CGI qw ( -utf8 );
|
||||||
use Test::MockModule;
|
use Test::MockModule;
|
||||||
use List::MoreUtils qw/all any none/;
|
use List::MoreUtils qw/all any none/;
|
||||||
use Test::More tests => 8;
|
use Test::More tests => 11;
|
||||||
|
use Test::Warn;
|
||||||
use C4::Members;
|
use C4::Members;
|
||||||
use Koha::AuthUtils qw/hash_password/;
|
use Koha::AuthUtils qw/hash_password/;
|
||||||
|
|
||||||
|
@ -105,6 +106,27 @@ $dbh->{RaiseError} = 1;
|
||||||
|
|
||||||
ok( ( any { $_->name eq 'KohaOpacLanguage' and $_->value eq 'en' } @$cookies ),
|
ok( ( any { $_->name eq 'KohaOpacLanguage' and $_->value eq 'en' } @$cookies ),
|
||||||
'BZ9735: invalid language, then default to en');
|
'BZ9735: invalid language, then default to en');
|
||||||
|
|
||||||
|
for my $template_name (
|
||||||
|
qw(
|
||||||
|
../../../../../../../../../../../../../../../etc/passwd
|
||||||
|
test/../../../../../../../../../../../../../../etc/passwd
|
||||||
|
/etc/passwd
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
eval {
|
||||||
|
( $template, $loggedinuser, $cookies ) = get_template_and_user(
|
||||||
|
{
|
||||||
|
template_name => $template_name,
|
||||||
|
query => $query,
|
||||||
|
type => "intranet",
|
||||||
|
authnotrequired => 1,
|
||||||
|
flagsrequired => { catalogue => 1 },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
like ( $@, qr(^bad template path), 'The file $template_name should not be accessible' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that there is always an OPACBaseURL set.
|
# Check that there is always an OPACBaseURL set.
|
||||||
|
|
Loading…
Reference in a new issue