Bugzilla – Attachment 126632 Details for
Bug 29272
API not respecting $category->effective_change_password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29272: Regression tests
Bug-29272-Regression-tests.patch (text/plain), 2.44 KB, created by
David Nind
on 2021-10-20 23:20:06 UTC
(
hide
)
Description:
Bug 29272: Regression tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-10-20 23:20:06 UTC
Size:
2.44 KB
patch
obsolete
>From 8b6d03bc75b7e3a20b7d689190bcfa8bb2e2e944 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 19 Oct 2021 10:27:53 -0300 >Subject: [PATCH] Bug 29272: Regression tests > >This patch introduces regression tests for the described bug. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/api/v1/patrons_password.t >=> FAIL: Tests fail, excepted failures are considered success > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/api/v1/patrons_password.t | 29 ++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/patrons_password.t b/t/db_dependent/api/v1/patrons_password.t >index 33581c51a0..95f8e5fca9 100755 >--- a/t/db_dependent/api/v1/patrons_password.t >+++ b/t/db_dependent/api/v1/patrons_password.t >@@ -117,11 +117,23 @@ subtest 'set() (authorized user tests)' => sub { > > subtest 'set_public() (unprivileged user tests)' => sub { > >- plan tests => 15; >+ plan tests => 18; > > $schema->storage->txn_begin; > >- my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $category = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { change_password => 0 } # disallow changing password for the patron category >+ } >+ ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { categorycode => $category->id } >+ } >+ ); >+ > my $password = 'thePassword123'; > $patron->set_password( { password => $password, skip_validation => 1 } ); > my $userid = $patron->userid; >@@ -165,6 +177,19 @@ subtest 'set_public() (unprivileged user tests)' => sub { > ->json_is( '/error', > "Authorization failure. Missing required permission(s)." ); > >+ $t->post_ok( >+ "//$userid:$password@/api/v1/public/patrons/" >+ . $patron->id >+ . "/password" => json => { >+ password => $new_password, >+ password_repeated => $new_password, >+ old_password => $password >+ } >+ )->status_is(403)->json_is({ error => 'Changing password is forbidden' }); >+ >+ # Allow password changing to the patron category >+ $category->change_password(1)->store; >+ > $t->post_ok( > "//$userid:$password@/api/v1/public/patrons/" > . $patron->id >-- >2.20.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 29272
:
126501
|
126502
|
126632
|
126633
|
126814
|
126976
|
126977
|
126978