Bugzilla – Attachment 61634 Details for
Bug 18314
Account lockout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18314: Add tests
Bug-18314-Add-tests.patch (text/plain), 1.91 KB, created by
Jonathan Druart
on 2017-03-24 18:44:51 UTC
(
hide
)
Description:
Bug 18314: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-03-24 18:44:51 UTC
Size:
1.91 KB
patch
obsolete
>From 4ebb2d51cdbe7a19c01dd488f05ff6a0573f3300 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 21 Mar 2017 21:18:17 -0300 >Subject: [PATCH] Bug 18314: Add tests > >--- > t/db_dependent/Koha/Patrons.t | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 24a4a3d..4e5305e 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 21; >+use Test::More tests => 22; > use Test::Warn; > use DateTime; > >@@ -881,6 +881,26 @@ subtest 'search_patrons_to_anonymise & anonymise_issue_history' => sub { > Koha::Patrons->find( $userenv_patron->{borrowernumber})->delete; > }; > >+subtest 'account_locked' => sub { >+ plan tests => 8; >+ my $patron = $builder->build({ source => 'Borrower', value => { login_attempts => 0 } }); >+ $patron = Koha::Patrons->find( $patron->{borrowernumber} ); >+ for my $value ( undef, '', 0 ) { >+ t::lib::Mocks::mock_preference('FailedloginAttempts', $value); >+ is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' ); >+ $patron->login_attempts(1)->store; >+ is( $patron->account_locked, 0, 'Feature is disabled, patron account should not be considered locked' ); >+ } >+ >+ t::lib::Mocks::mock_preference('FailedloginAttempts', 3); >+ $patron->login_attempts(2)->store; >+ is( $patron->account_locked, 0, 'Patron has 2 failed attempts, account should not be considered locked yet' ); >+ $patron->login_attempts(3)->store; >+ is( $patron->account_locked, 1, 'Patron has 3 failed attempts, account should be considered locked yet' ); >+ >+ $patron->delete; >+}; >+ > $retrieved_patron_1->delete; > is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); > >-- >2.9.3
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 18314
:
61630
|
61631
|
61632
|
61633
|
61634
|
62453
|
62454
|
62455
|
62456
|
62457
|
62872
|
62873
|
62874
|
62875
|
62876
|
62877
|
62878
|
62884
|
62885
|
62886
|
62887
|
62888
|
62889
|
62890
|
62891