Bugzilla – Attachment 106297 Details for
Bug 25662
Create hold route does not check maxreserves syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25662: Regression tests
Bug-25662-Regression-tests.patch (text/plain), 3.66 KB, created by
Kyle M Hall (khall)
on 2020-06-25 14:33:45 UTC
(
hide
)
Description:
Bug 25662: Regression tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-06-25 14:33:45 UTC
Size:
3.66 KB
patch
obsolete
>From c1abc66a63e8e020f2daae6a03a9be163c924633 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 23 Jun 2020 10:11:58 -0300 >Subject: [PATCH] Bug 25662: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/api/v1/holds.t | 87 ++++++++++++++++++++++++++++++++++- > 1 file changed, 86 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t >index f7436da0ee..348cb6bc26 100644 >--- a/t/db_dependent/api/v1/holds.t >+++ b/t/db_dependent/api/v1/holds.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 8; >+use Test::More tests => 9; > use Test::Mojo; > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -572,3 +572,88 @@ subtest 'PUT /holds/{hold_id}/priority tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'add() tests (maxreserves behaviour)' => sub { >+ >+ plan tests => 7; >+ >+ $schema->storage->txn_begin; >+ >+ $dbh->do('DELETE FROM reserves'); >+ >+ Koha::CirculationRules->new->delete; >+ >+ my $password = 'AbcdEFG123'; >+ >+ my $patron = $builder->build_object( >+ { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 1 } } ); >+ $patron->set_password({ password => $password, skip_validation => 1 }); >+ my $userid = $patron->userid; >+ >+ Koha::CirculationRules->set_rules( >+ { >+ itemtype => undef, >+ branchcode => undef, >+ categorycode => undef, >+ rules => { >+ reservesallowed => 3 >+ } >+ } >+ ); >+ >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => $patron->categorycode, >+ rules => { >+ max_holds => 4, >+ } >+ } >+ ); >+ >+ my $biblio_1 = $builder->build_sample_biblio; >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber }); >+ my $biblio_2 = $builder->build_sample_biblio; >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber }); >+ my $biblio_3 = $builder->build_sample_biblio; >+ my $item_3 = $builder->build_sample_item({ biblionumber => $biblio_3->biblionumber }); >+ >+ # Disable logging >+ t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); >+ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); >+ t::lib::Mocks::mock_preference( 'maxreserves', 2 ); >+ t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 ); >+ >+ my $post_data = { >+ patron_id => $patron->borrowernumber, >+ biblio_id => $biblio_1->biblionumber, >+ pickup_library_id => $item_1->home_branch->branchcode, >+ item_type => $item_1->itype, >+ }; >+ >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(201); >+ >+ $post_data = { >+ patron_id => $patron->borrowernumber, >+ biblio_id => $biblio_2->biblionumber, >+ pickup_library_id => $item_2->home_branch->branchcode, >+ item_id => $item_2->itemnumber >+ }; >+ >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(201); >+ >+ $post_data = { >+ patron_id => $patron->borrowernumber, >+ biblio_id => $biblio_3->biblionumber, >+ pickup_library_id => $item_1->home_branch->branchcode, >+ item_id => $item_3->itemnumber >+ }; >+ >+ $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $post_data ) >+ ->status_is(403) >+ ->json_is( { error => 'Hold cannot be placed. Reason: tooManyReserves' } ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.24.1 (Apple Git-126)
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 25662
:
106204
|
106205
|
106206
|
106212
|
106213
|
106214
|
106297
|
106298
|
106299
|
108940
|
108941
|
108942