Bugzilla – Attachment 167802 Details for
Bug 37104
Block AnonymousPatron from logging into anything
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37104: Unit tests
Bug-37104-Unit-tests.patch (text/plain), 3.19 KB, created by
Sam Lau
on 2024-06-17 19:40:55 UTC
(
hide
)
Description:
Bug 37104: Unit tests
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-06-17 19:40:55 UTC
Size:
3.19 KB
patch
obsolete
>From 2dcae2f775a6a579368faea40afb16bc65d427e9 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Mon, 17 Jun 2024 19:31:52 +0000 >Subject: [PATCH] Bug 37104: Unit tests > >prove t/db-dependent/Auth.t >--- > t/db_dependent/Auth.t | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index 99beff8975..2e6a8503ff 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -684,7 +684,7 @@ subtest 'Check value of login_attempts in checkpw' => sub { > }; > > subtest 'Check value of login_attempts in checkpw' => sub { >- plan tests => 2; >+ plan tests => 3; > > t::lib::Mocks::mock_preference('FailedLoginAttempts', 3); > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >@@ -697,6 +697,10 @@ subtest 'Check value of login_attempts in checkpw' => sub { > @test = checkpw( $patron->userid, '123', undef, 'opac', 1 ); > is( $test[0], -2, 'Patron returned as expired correctly' ); > >+ ## Make our patron the anonymous patron >+ t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); >+ @test = checkpw( $patron->userid, '123', undef, 'opac', 1 ); >+ is ($test[0], -3, 'Patron returned as anonymous patron correctly' ); > }; > > subtest '_timeout_syspref' => sub { >@@ -1075,7 +1079,7 @@ subtest 'checkpw() return values tests' => sub { > > subtest 'Internal check tests' => sub { > >- plan tests => 25; >+ plan tests => 29; > > $schema->storage->txn_begin; > >@@ -1132,6 +1136,14 @@ subtest 'checkpw() return values tests' => sub { > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); > >+ t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); >+ @return = checkpw( $patron->userid, $password, undef, ); >+ >+ is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( $return[0], -3, '-3 returned' ); >+ is( ref( $return[1] ), 'Koha::Patron' ); >+ is( $return[1]->id, $patron->id, 'Patron matched correctly' ); >+ > @return = checkpw( $unused_userid, $password, undef, ); > > is( scalar @return, 2, "Two results on non-existing userid scenario" ); >@@ -1149,7 +1161,7 @@ subtest 'checkpw() return values tests' => sub { > > subtest 'CAS check (mocked) tests' => sub { > >- plan tests => 25; >+ plan tests => 29; > > $schema->storage->txn_begin; > >@@ -1216,6 +1228,13 @@ subtest 'checkpw() return values tests' => sub { > is( ref( $return[1] ), 'Koha::Patron' ); > is( $return[1]->id, $patron->id, 'Patron matched correctly' ); > >+ t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id ); >+ @return = checkpw( $patron->userid, $password, undef, ); >+ is( scalar @return, 2, "Two results on expired password scenario" ); >+ is( $return[0], -3, '-3 returned' ); >+ is( ref( $return[1] ), 'Koha::Patron' ); >+ is( $return[1]->id, $patron->id, 'Patron matched correctly' ); >+ > @return = checkpw( $unused_userid, $password, $query, ); > > is( scalar @return, 2, "Two results on non-existing userid scenario" ); >-- >2.39.2
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 37104
:
167793
|
167795
|
167798
|
167801
|
167802
|
167811
|
167812
|
167813
|
168268
|
168269
|
168270
|
168592
|
168666
|
168694