Bugzilla – Attachment 52189 Details for
Bug 16492
Checkouts ( and possibly checkins and other actions ) will use the patron home branch as the logged in library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16492: Test that no_set_userenv will not set userenv if not exist yet
Bug-16492-Test-that-nosetuserenv-will-not-set-user.patch (text/plain), 3.43 KB, created by
Jonathan Druart
on 2016-06-08 14:33:40 UTC
(
hide
)
Description:
Bug 16492: Test that no_set_userenv will not set userenv if not exist yet
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-06-08 14:33:40 UTC
Size:
3.43 KB
patch
obsolete
>From 8acf867ed6144350f02707dbc830c0d0936e21ab Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 25 May 2016 17:33:00 +0100 >Subject: [PATCH] Bug 16492: Test that no_set_userenv will not set userenv if > not exist yet > >--- > t/db_dependent/Auth.t | 43 ++++++++++++++++++++++++------------------- > 1 file changed, 24 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index b5e1ef1..aa703ec 100644 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -8,7 +8,7 @@ use Modern::Perl; > use CGI qw ( -utf8 ); > use Test::MockModule; > use List::MoreUtils qw/all any none/; >-use Test::More tests => 18; >+use Test::More tests => 20; > use Test::Warn; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -27,6 +27,29 @@ $schema->storage->txn_begin; > my $builder = t::lib::TestBuilder->new; > my $dbh = C4::Context->dbh; > >+my $hash1 = hash_password('password'); >+my $hash2 = hash_password('password'); >+ >+{ # tests no_set_userenv parameter >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ changepassword( $patron->{userid}, $patron->{borrowernumber}, $hash1 ); >+ my $library = $builder->build( >+ { >+ source => 'Branch', >+ } >+ ); >+ >+ ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 1 ), 'checkpw returns true' ); >+ is( C4::Context->userenv, undef, 'Userenv should be undef as required' ); >+ C4::Context->_new_userenv('DUMMY SESSION'); >+ C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Library 1', 0, '', ''); >+ is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv gives correct branch' ); >+ ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 1 ), 'checkpw returns true' ); >+ is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is preserved if no_set_userenv is true' ); >+ ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 0 ), 'checkpw still returns true' ); >+ isnt( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is overwritten if no_set_userenv is false' ); >+} >+ > # get_template_and_user tests > > { # Tests for the language URL parameter >@@ -172,23 +195,5 @@ my ( $template2 ); > ok( ( any { 'OPACBaseURL' eq $_ } keys %{$template2->{VARS}} ), > 'OPACBaseURL is in Staff template' ); > >-my $hash1 = hash_password('password'); >-my $hash2 = hash_password('password'); >- > ok(C4::Auth::checkpw_hash('password', $hash1), 'password validates with first hash'); > ok(C4::Auth::checkpw_hash('password', $hash2), 'password validates with second hash'); >- >-my $patron = $builder->build( { source => 'Borrower' } ); >-changepassword( $patron->{userid}, $patron->{borrowernumber}, $hash1 ); >-my $library = $builder->build( >- { >- source => 'Branch', >- } >-); >- >-C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Library 1', 0, '', ''); >-is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv gives correct branch' ); >-ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 1 ), 'checkpw returns true' ); >-is( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is preserved if no_set_userenv is true' ); >-ok( checkpw( $dbh, $patron->{userid}, 'password', undef, undef, 0 ), 'checkpw still returns true' ); >-isnt( C4::Context->userenv->{branch}, $library->{branchcode}, 'Userenv branch is overwritten if no_set_userenv is false' ); >-- >2.8.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16492
:
51390
|
51391
|
51744
|
51745
|
51768
|
51797
|
52188
| 52189 |
52190