Bugzilla – Attachment 87903 Details for
Bug 22692
Logging in via cardnumber circumvents account logout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22692: Unit tests
Bug-22692-Unit-tests.patch (text/plain), 2.50 KB, created by
Martin Renvoize (ashimema)
on 2019-04-12 12:53:47 UTC
(
hide
)
Description:
Bug 22692: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-12 12:53:47 UTC
Size:
2.50 KB
patch
obsolete
>From 96952d9b48ed8c1ead136962d61d74ca0d581b2e Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 12 Apr 2019 01:11:19 +0000 >Subject: [PATCH] Bug 22692: Unit tests > >1 - Apply just this patch >2 - prove -v t/db_dependent/Auth.t >3 - Failure >4 - Apply second patch >5 - prove -v t/db_dependent/Auth.t >6 - Success > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Auth.t | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index e0b6036f41..94799c05d9 100644 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -10,7 +10,7 @@ use CGI qw ( -utf8 ); > use Test::MockObject; > use Test::MockModule; > use List::MoreUtils qw/all any none/; >-use Test::More tests => 20; >+use Test::More tests => 21; > use Test::Warn; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -137,6 +137,30 @@ subtest 'no_set_userenv parameter tests' => sub { > isnt( C4::Context->userenv->{branch}, $library->branchcode, 'Userenv branch is overwritten if no_set_userenv is false' ); > }; > >+subtest 'checkpw lockout tests' => sub { >+ >+ plan tests => 5; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $password = 'password'; >+ t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); >+ t::lib::Mocks::mock_preference( 'FailedLoginAttempts', 1 ); >+ $patron->set_password({ password => $password }); >+ >+ my ( $checkpw, undef, undef ) = checkpw( $dbh, $patron->cardnumber, $password, undef, undef, 1 ); >+ ok( $checkpw, 'checkpw returns true with right password when logging in via cardnumber' ); >+ ( $checkpw, undef, undef ) = checkpw( $dbh, $patron->userid, "wrong_password", undef, undef, 1 ); >+ is( $checkpw, 0, 'checkpw returns false when given wrong password' ); >+ $patron = $patron->get_from_storage; >+ is( $patron->account_locked, 1, "Account is locked from failed login"); >+ ( $checkpw, undef, undef ) = checkpw( $dbh, $patron->userid, $password, undef, undef, 1 ); >+ is( $checkpw, undef, 'checkpw returns undef with right password when account locked' ); >+ ( $checkpw, undef, undef ) = checkpw( $dbh, $patron->cardnumber, $password, undef, undef, 1 ); >+ is( $checkpw, undef, 'checkpw returns undefwith right password when logging in via cardnumber if account locked' ); >+ >+}; >+ > # get_template_and_user tests > > { # Tests for the language URL parameter >-- >2.20.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 22692
:
87826
|
87827
|
87903
|
87904
|
87976
|
87977