Bugzilla – Attachment 57358 Details for
Bug 17006
Add route to change patron's password (authenticated)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17006: (follow-up) Test for changing another user's password
SIGNED-OFF-Bug-17006-follow-up-Test-for-changing-a.patch (text/plain), 2.33 KB, created by
Josef Moravec
on 2016-11-08 22:01:34 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17006: (follow-up) Test for changing another user's password
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-11-08 22:01:34 UTC
Size:
2.33 KB
patch
obsolete
>From 728bb460b735723e10a00908630370ff00acd376 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Thu, 13 Oct 2016 15:10:36 +0300 >Subject: [PATCH] [SIGNED-OFF] Bug 17006: (follow-up) Test for changing another > user's password > >The previous patches work for changing your own password, but the tests are >lacking a case where librarian attempts to change patron's password. This >feature was unnoticed and not implemented. > >To test: >1. Run t/db_dependent/api/v1/patrons.t >2. Observe failing test >3. Proceed to next patch to fix the failing test > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/api/v1/patrons.t | 24 +++++++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 551a4d0..d539259 100644 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > >-use Test::More tests => 43; >+use Test::More tests => 45; > use Test::Mojo; > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -62,6 +62,16 @@ my $borrower = $builder->build({ > } > }); > >+my $librarian = $builder->build({ >+ source => 'Borrower', >+ value => { >+ branchcode => $branchcode, >+ categorycode => $categorycode, >+ flags => 16, >+ password => Koha::AuthUtils::hash_password("test"), >+ } >+}); >+ > $t->get_ok('/api/v1/patrons') > ->status_is(401); > >@@ -82,6 +92,13 @@ $session2->param('ip', '127.0.0.1'); > $session2->param('lasttime', time()); > $session2->flush; > >+my $session3 = C4::Auth::get_session(''); >+$session3->param('number', $librarian->{ borrowernumber }); >+$session3->param('id', $librarian->{ userid }); >+$session3->param('ip', '127.0.0.1'); >+$session3->param('lasttime', time()); >+$session3->flush; >+ > my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); > $tx->req->cookies({name => 'CGISESSID', value => $session->id}); > $t->request_ok($tx) >@@ -209,4 +226,9 @@ $tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id}); > $t->request_ok($tx) > ->status_is(200); > >+$tx = $t->ua->build_tx(PATCH => '/api/v1/patrons/'.$borrower->{borrowernumber}.'/password' => json => $password_obj); >+$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); >+$t->request_ok($tx) >+ ->status_is(200); >+ > $schema->storage->txn_rollback; >-- >2.1.4
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 17006
:
54575
|
54576
|
54629
|
54630
|
54716
|
54717
|
54718
|
56155
|
56156
|
56157
|
56158
|
56283
|
56284
|
56399
|
56400
|
56401
|
56409
|
57356
|
57357
|
57358
|
57359
|
57360
|
63329
|
63330
|
63331
|
63332
|
63333
|
67128
|
67129
|
67130
|
67131
|
67132
|
70260
|
70261
|
70262
|
70263
|
70264
|
77882
|
77883
|
77884
|
77923
|
77924
|
77925
|
78837
|
82625
|
82626
|
82627
|
82628
|
83579
|
83580
|
83581
|
83749
|
83750
|
83751
|
84285
|
84286
|
84287
|
84488