Bugzilla – Attachment 100425 Details for
Bug 23011
AuthenticatePatron could alert if password is not safe
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23011: Add new tests (AuthenticatePatron error codes)
Bug-23011-Add-new-tests-AuthenticatePatron-error-c.patch (text/plain), 3.02 KB, created by
Emmi Takkinen
on 2020-03-10 09:33:25 UTC
(
hide
)
Description:
Bug 23011: Add new tests (AuthenticatePatron error codes)
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2020-03-10 09:33:25 UTC
Size:
3.02 KB
patch
obsolete
>From a889c8d99cf8fc6c57c602fb7bab3b43696f3b50 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Fri, 20 Dec 2019 18:01:42 +0100 >Subject: [PATCH] Bug 23011: Add new tests (AuthenticatePatron error codes) > >This bug add new tests to the AuthenticatePatron ILS-DI service. >It tests new error codes patron might get when successfully connecting >but with a password which doesn't match Koha security rules. > >Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com> >--- > t/db_dependent/ILSDI_Services.t | 52 ++++++++++++++++++++++++++++++++- > 1 file changed, 51 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index d7fe08f65f..6789d3e390 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use Test::More tests => 9; >+use Test::More tests => 10; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -104,6 +104,56 @@ subtest 'AuthenticatePatron test' => sub { > }; > > >+subtest 'AuthenticatePatron Secure Password test' => sub { >+ >+ plan tests => 10; >+ >+ $schema->storage->txn_begin; >+ >+ my $plain_password = 'tomasito'; >+ >+ $builder->build({ >+ source => 'Borrower', >+ value => { >+ cardnumber => undef, >+ } >+ }); >+ >+ my $borrower = $builder->build({ >+ source => 'Borrower', >+ value => { >+ cardnumber => undef, >+ password => Koha::AuthUtils::hash_password( $plain_password ) >+ } >+ }); >+ >+ my $query = new CGI; >+ $query->param( 'username', $borrower->{userid}); >+ $query->param( 'password', $plain_password); >+ >+ my $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); >+ is( $reply->{id}, $borrower->{borrowernumber}, "userid and password - Patron authenticated" ); >+ is( $reply->{code}, undef, "Error code undef"); >+ >+ t::lib::Mocks::mock_preference( 'minPasswordLength', 10 ); >+ $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); >+ is( $reply->{id}, $borrower->{borrowernumber}, "existing user"); >+ is( $reply->{code}, 'PatronPasswordNotSecure', "PasswordNotSecure" ); >+ is( $reply->{securePasswordLabel}, 'too_short', "PasswordTooShort" ); >+ is( $reply->{securePasswordPattern}, '.{10}', "Password must be at least 10 char" ); >+ >+ t::lib::Mocks::mock_preference( 'RequireStrongPassword', 1 ); >+ t::lib::Mocks::mock_preference( 'minPasswordLength', 5 ); >+ $reply = C4::ILSDI::Services::AuthenticatePatron( $query ); >+ is( $reply->{id}, $borrower->{borrowernumber}, "existing user"); >+ is( $reply->{code}, 'PatronPasswordNotSecure', "PasswordNotSecure" ); >+ is( $reply->{securePasswordLabel}, 'too_weak', "PasswordTooWeak" ); >+ is( $reply->{securePasswordPattern}, '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{5}', "Password must be strong (pattern match)" ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+ > subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes' => sub { > > plan tests => 5; >-- >2.17.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 23011
:
93512
|
93517
|
96560
|
96561
|
96562
|
100423
|
100424
|
100425
|
100426
|
106565
|
106566
|
106567