Bugzilla – Attachment 71936 Details for
Bug 16330
Add routes to add, update and delete patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16330: (QA follow-up) ModMember requires borrowernumber
Bug-16330-QA-follow-up-ModMember-requires-borrower.patch (text/plain), 2.86 KB, created by
Josef Moravec
on 2018-02-19 11:34:21 UTC
(
hide
)
Description:
Bug 16330: (QA follow-up) ModMember requires borrowernumber
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-02-19 11:34:21 UTC
Size:
2.86 KB
patch
obsolete
>From 50799f2545e28c564b5dab27983ebfd83cc9a915 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 12 Dec 2017 18:53:45 -0300 >Subject: [PATCH] Bug 16330: (QA follow-up) ModMember requires borrowernumber >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Works perfectly. Well done everyone! > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> >Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/REST/V1/Patrons.pm | 5 ++++- > t/db_dependent/api/v1/patrons.t | 7 ++++--- > 2 files changed, 8 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 357c099..7868e8d 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -154,7 +154,10 @@ sub update { > > $patron->set( _to_model($body) )->_validate; > >- # TODO: Use ModMember until it has been moved to Koha-namespace >+ ## TODO: Use ModMember until it has been moved to Koha-namespace >+ # Add borrowernumber to $body, as required by ModMember >+ $body->{borrowernumber} = $patron->borrowernumber; >+ > if ( ModMember(%$body) ) { > return $c->render( status => 200, openapi => $patron ); > } >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 26e241b..a23b47b 100644 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -231,6 +231,8 @@ subtest 'update() tests' => sub { > my $patron_1 = Koha::Patrons->find($borrowernumber); > my $patron_2 = Koha::Patrons->find($borrowernumber2); > my $newpatron = $patron_2->TO_JSON; >+ # borrowernumber should not be passed in the request body for PUT >+ delete $newpatron->{borrowernumber}; > > my $tx = $t->ua->build_tx(PUT => "/api/v1/patrons/-1" => json => $newpatron ); > $tx->req->cookies({name => 'CGISESSID', value => $sessionid}); >@@ -282,13 +284,12 @@ subtest 'update() tests' => sub { > $newpatron->{ userid } = "user".$borrowernumber.$borrowernumber2; > $newpatron->{ surname } = "user".$borrowernumber.$borrowernumber2; > >- $tx = $t->ua->build_tx(PUT => "/api/v1/patrons/" . >- $newpatron->{borrowernumber} => json => $newpatron); >+ $tx = $t->ua->build_tx(PUT => "/api/v1/patrons/" . $patron_2->id => json => $newpatron); > $tx->req->cookies({name => 'CGISESSID', value => $sessionid}); > $t->request_ok($tx) > ->status_is(200, 'Patron updated successfully') > ->json_has($newpatron); >- is(Koha::Patrons->find($newpatron->{borrowernumber})->cardnumber, >+ is(Koha::Patrons->find( $patron_2->id )->cardnumber, > $newpatron->{ cardnumber }, 'Patron is really updated!'); > }; > >-- >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 16330
:
50803
|
50889
|
51066
|
51131
|
51132
|
53216
|
53217
|
53820
|
54942
|
55147
|
56666
|
56667
|
56668
|
63646
|
63647
|
63649
|
63650
|
69546
|
69547
|
69548
|
69549
|
69550
|
69551
|
69752
|
69762
|
69763
|
69764
|
69765
|
69766
|
69767
|
69768
|
69787
|
70034
|
70035
|
70036
|
70037
|
70038
|
71667
|
71668
|
71669
|
71670
|
71671
|
71920
|
71921
|
71922
|
71923
|
71924
|
71925
|
71933
|
71934
|
71935
| 71936 |
71937
|
71938
|
73434