Bug 17431: (follow-up) Fix issuingrules
authorLari Taskula <lari.taskula@jns.fi>
Wed, 19 Oct 2016 12:18:02 +0000 (15:18 +0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 17 Nov 2016 16:22:31 +0000 (16:22 +0000)
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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
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

index 184beff..8e79d19 100644 (file)
@@ -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)