Bugzilla – Attachment 168268 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.31 KB, created by
Martin Renvoize (ashimema)
on 2024-06-28 15:49:23 UTC
(
hide
)
Description:
Bug 37104: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-28 15:49:23 UTC
Size:
3.31 KB
patch
obsolete
>From 9202e4adf185facc031ee5af48a39e50622ceb9d 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 > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > 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 2da1d683527..28c1300de8c 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -686,7 +686,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' }); >@@ -699,6 +699,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 { >@@ -1077,7 +1081,7 @@ subtest 'checkpw() return values tests' => sub { > > subtest 'Internal check tests' => sub { > >- plan tests => 25; >+ plan tests => 29; > > $schema->storage->txn_begin; > >@@ -1134,6 +1138,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" ); >@@ -1151,7 +1163,7 @@ subtest 'checkpw() return values tests' => sub { > > subtest 'CAS check (mocked) tests' => sub { > >- plan tests => 25; >+ plan tests => 29; > > $schema->storage->txn_begin; > >@@ -1218,6 +1230,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.45.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