From 8a04ecce9e44799bb4c6aae0951e35c08b12ca1b Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 19 Oct 2016 15:18:02 +0300 Subject: [PATCH] Bug 17431: (follow-up) Fix issuingrules Issuingrules could had prevented holds.t from passing with error tooManyReserves. This patch sets issuingrules at the beginning of the test to make sure reserves are allowed. To test: 1. Apply patch & Run t/db_dependent/api/v1/holds.t 2. Observe test pass --- t/db_dependent/api/v1/holds.t | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index 184beff..8e79d19 100644 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -114,6 +114,11 @@ my $biblionumber2 = create_biblio('RESTful Web APIs'); my $itemnumber2 = create_item($biblionumber2, 'TEST000002'); $dbh->do('DELETE FROM reserves'); +$dbh->do('DELETE FROM issuingrules'); + $dbh->do(q{ + INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) + VALUES (?, ?, ?, ?) + }, {}, '*', '*', '*', 1); my $reserve_id = C4::Reserves::AddReserve($branchcode, $borrowernumber, $biblionumber, undef, 1, undef, undef, undef, '', $itemnumber); @@ -263,12 +268,6 @@ subtest "Test endpoints with permission" => sub { ->status_is(200) ->json_is([]); - $dbh->do('DELETE FROM issuingrules'); - $dbh->do(q{ - INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed) - VALUES (?, ?, ?, ?) - }, {}, '*', '*', '*', 1); - $tx = $t->ua->build_tx(DELETE => "/api/v1/holds/$reserve_id2"); $tx->req->cookies({name => 'CGISESSID', value => $session3->id}); $t->request_ok($tx) -- 1.9.1