Bugzilla – Attachment 159956 Details for
Bug 35204
REST API: POST endpoint /auth/password/validation dies on patron with expired password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35204: Add unit tests
Bug-35204-Add-unit-tests.patch (text/plain), 2.04 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-12-18 12:13:03 UTC
(
hide
)
Description:
Bug 35204: Add unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-12-18 12:13:03 UTC
Size:
2.04 KB
patch
obsolete
>From 51699efaf7298ee3247b2f622d0956582b051272 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Mon, 18 Dec 2023 11:00:06 +0000 >Subject: [PATCH] Bug 35204: Add unit tests > >prove t/db_dependent/api/v1/password_validation.t > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/password_validation.t | 34 ++++++++++++++++++++- > 1 file changed, 33 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/password_validation.t b/t/db_dependent/api/v1/password_validation.t >index c37c4ff14ee..10527bc93d0 100755 >--- a/t/db_dependent/api/v1/password_validation.t >+++ b/t/db_dependent/api/v1/password_validation.t >@@ -18,13 +18,14 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > use Test::Mojo; > > use t::lib::TestBuilder; > use t::lib::Mocks; > > use Koha::Database; >+use Koha::DateUtils qw(dt_from_string); > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -207,4 +208,35 @@ subtest 'Password validation - authorized requests tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'password validation - expired password' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 2**2 } # catalogue flag = 2 >+ } >+ ); >+ my $patron_password = 'thePassword123'; >+ $patron->set_password( { password => $patron_password, skip_validation => 1 } ); >+ >+ my $date = dt_from_string(); >+ my $expiration_date = $date->subtract( days => 1 ); >+ >+ $patron->password_expiration_date($expiration_date)->store; >+ >+ my $json = { >+ identifier => $patron->userid, >+ password => $patron_password, >+ }; >+ >+ $t->post_ok( "//$userid:$password@/api/v1/auth/password/validation" => json => $json )->status_is(400) >+ ->json_is( '/error' => 'Password expired' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > $schema->storage->txn_rollback; >-- >2.43.0
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 35204
:
159612
|
159939
|
159940
| 159956 |
159957