Bug 32178: (follow-up) Transform 'staff' interface to 'intranet'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Agustin Moyano 2022-11-15 09:17:11 -03:00 committed by Tomas Cohen Arazi
parent ca57674700
commit 937b7114d0
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 8 additions and 4 deletions

View file

@ -1880,6 +1880,8 @@ sub create_basic_session {
my $patron = $params->{patron};
my $interface = $params->{interface};
$interface = 'intranet' if $interface eq 'staff';
my $session = get_session("");
$session->param( 'number', $patron->borrowernumber );

View file

@ -834,12 +834,11 @@ subtest 'Userenv clearing in check_cookie_auth' => sub {
};
subtest 'create_basic_session tests' => sub {
plan tests => 12;
plan tests => 13;
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
my $interface = 'opac';
my $session = C4::Auth::create_basic_session({ patron => $patron, interface => $interface });
my $session = C4::Auth::create_basic_session({ patron => $patron, interface => 'opac' });
isnt($session->id, undef, 'A new sessionID was created');
is( $session->param('number'), $patron->borrowernumber, 'Session parameter number matches' );
@ -852,7 +851,10 @@ subtest 'create_basic_session tests' => sub {
is( $session->param('flags'), $patron->flags, 'Session parameter flags matches' );
is( $session->param('emailaddress'), $patron->email, 'Session parameter emailaddress matches' );
is( $session->param('ip'), $session->remote_addr(), 'Session parameter ip matches' );
is( $session->param('interface'), $interface, 'Session parameter interface matches' );
is( $session->param('interface'), 'opac', 'Session parameter interface matches' );
$session = C4::Auth::create_basic_session({ patron => $patron, interface => 'staff' });
is( $session->param('interface'), 'intranet', 'Staff interface gets converted to intranet' );
};
$schema->storage->txn_rollback;