Bugzilla – Attachment 93758 Details for
Bug 17005
Extend /checkouts route to list circulation history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17005: Test for checked_in parameter
Bug-17005-Test-for-checkedin-parameter.patch (text/plain), 3.06 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-10-04 19:21:33 UTC
(
hide
)
Description:
Bug 17005: Test for checked_in parameter
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-10-04 19:21:33 UTC
Size:
3.06 KB
patch
obsolete
>From 71c56ae124b3d2671bff1d927a2998bfcfbbbb5f Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Mon, 1 Apr 2019 08:24:23 +0000 >Subject: [PATCH] Bug 17005: Test for checked_in parameter > >Test plan: >prove t/db_dependent/api/v1/checkouts.t > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/checkouts.t | 22 +++++++++++++++++++++- > 1 file changed, 21 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/checkouts.t b/t/db_dependent/api/v1/checkouts.t >index 89e16fdb50..5a3447412e 100644 >--- a/t/db_dependent/api/v1/checkouts.t >+++ b/t/db_dependent/api/v1/checkouts.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 79; >+use Test::More tests => 93; > use Test::MockModule; > use Test::Mojo; > use t::lib::Mocks; >@@ -74,6 +74,7 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$notexisting_patron > my $item1 = $builder->build_sample_item; > my $item2 = $builder->build_sample_item; > my $item3 = $builder->build_sample_item; >+my $item4 = $builder->build_sample_item; > > my $date_due = DateTime->now->add(weeks => 2); > my $issue1 = C4::Circulation::AddIssue($patron->unblessed, $item1->barcode, $date_due); >@@ -82,6 +83,8 @@ my $issue2 = C4::Circulation::AddIssue($patron->unblessed, $item2->barcode, $dat > my $date_due2 = Koha::DateUtils::dt_from_string( $issue2->date_due ); > my $issue3 = C4::Circulation::AddIssue($librarian->unblessed, $item3->barcode, $date_due); > my $date_due3 = Koha::DateUtils::dt_from_string( $issue3->date_due ); >+my $issue4 = C4::Circulation::AddIssue($patron->unblessed, $item4->barcode); >+C4::Circulation::AddReturn($item4->barcode, $branchcode); > > $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id" ) > ->status_is(200) >@@ -93,6 +96,23 @@ $t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id" ) > ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) > ->json_hasnt('/2'); > >+# Test checked_in parameter, zero means, the response is same as without it >+$t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=0" ) >+ ->status_is(200) >+ ->json_is('/0/patron_id' => $patron_id) >+ ->json_is('/0/item_id' => $item1->itemnumber) >+ ->json_is('/0/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due1 }) ) >+ ->json_is('/1/patron_id' => $patron_id) >+ ->json_is('/1/item_id' => $item2->itemnumber) >+ ->json_is('/1/due_date' => output_pref({ dateformat => "rfc3339", dt => $date_due2 }) ) >+ ->json_hasnt('/2'); >+ >+# Test checked_in parameter, one measn, the checked in checkout is in the response too >+$t->get_ok( "//$userid:$password@/api/v1/checkouts?patron_id=$patron_id&checked_in=1" ) >+ ->status_is(200) >+ ->json_is('/0/patron_id' => $patron_id) >+ ->json_is('/0/item_id' => $item4->itemnumber) >+ ->json_hasnt('/1'); > > $t->get_ok( "//$unauth_userid:$unauth_password@/api/v1/checkouts/" . $issue3->issue_id ) > ->status_is(403) >-- >2.23.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 17005
:
53843
|
53851
|
53852
|
53858
|
54198
|
56698
|
56699
|
61197
|
87254
|
87255
|
87383
|
87384
|
87385
|
87405
|
87406
|
87407
|
87442
|
87443
|
87444
|
87447
|
87448
|
87449
|
88263
|
88264
|
88265
|
88329
|
88330
|
88331
|
91166
|
91167
|
91168
|
91235
|
91236
|
91237
|
91238
|
93757
| 93758 |
93759
|
93760