Bugzilla – Attachment 103951 Details for
Bug 20936
Holds history for patrons in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20936: Add API tests
Bug-20936-Add-API-tests.patch (text/plain), 3.15 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-04-29 14:18:45 UTC
(
hide
)
Description:
Bug 20936: Add API tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-04-29 14:18:45 UTC
Size:
3.15 KB
patch
obsolete
>From dbbb85dfe9567dc46f1c5616c0ecd3bbac5b0efa Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Thu, 5 Mar 2020 19:14:04 -0300 >Subject: [PATCH] Bug 20936: Add API tests > >Add test to /api/v1/public/patrons/:patron_id/holds endpoint > >To test: >1. prove t/db_dependent/api/v1/patrons_holds.t >--- > t/db_dependent/api/v1/patrons_holds.t | 82 +++++++++++++++++++++++++++ > 1 file changed, 82 insertions(+) > create mode 100644 t/db_dependent/api/v1/patrons_holds.t > >diff --git a/t/db_dependent/api/v1/patrons_holds.t b/t/db_dependent/api/v1/patrons_holds.t >new file mode 100644 >index 0000000000..1b3dae59b2 >--- /dev/null >+++ b/t/db_dependent/api/v1/patrons_holds.t >@@ -0,0 +1,82 @@ >+#!/usr/bin/env perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+use Test::Mojo; >+use Test::Warn; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+use Koha::Database; >+use Koha::Hold; >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+my $t = Test::Mojo->new('Koha::REST::V1'); >+t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); >+t::lib::Mocks::mock_preference( 'RESTPublicAPI', 1 ); >+ >+subtest 'list() tests' => sub { >+ plan tests => 15; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $password = 'thePassword123'; >+ $patron->set_password({ password => $password, skip_validation => 1 }); >+ my $userid = $patron->userid; >+ my $patron_id = $patron->borrowernumber; >+ >+ $t->get_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/holds") >+ ->status_is( 200 ) >+ ->json_is( [] ); >+ >+ my $biblio1 = $builder->build_sample_biblio; >+ >+ my $hold = Koha::Hold->new( >+ { >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $biblio1->biblionumber, >+ } >+ )->store; >+ >+ $t->get_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/holds") >+ ->status_is( 200 ) >+ ->json_is( '/0/hold_id', $hold->reserve_id ); >+ >+ $t->get_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/holds?old=true") >+ ->status_is( 200 ) >+ ->json_is( [] ); >+ >+ $hold->cancel(); >+ >+ >+ >+ $t->get_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/holds?old=true") >+ ->status_is( 200 ) >+ ->json_is( '/0/hold_id', $hold->reserve_id ); >+ >+ $t->get_ok("//$userid:$password@/api/v1/public/patrons/$patron_id/holds") >+ ->status_is( 200 ) >+ ->json_is( [] ); >+ >+ $schema->storage->txn_rollback; >+}; >\ No newline at end of file >-- >2.26.2
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 20936
:
98629
|
98630
|
100115
|
100116
|
100117
|
100205
|
100206
|
100207
|
100471
|
100472
|
100473
|
100474
|
101724
|
101725
|
101726
|
101727
|
101772
|
101915
|
102166
|
103948
|
103949
|
103950
|
103951
|
104040
|
104041
|
104466
|
104467
|
105131
|
112667
|
112668
|
112730
|
112731
|
112732
|
112733
|
113446
|
113447
|
113448
|
113449