Browse Source

Bug 28254: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
tags/v21.05.00
Tomas Cohen Arazi 1 month ago
parent
commit
e3baa979cf
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      t/db_dependent/api/v1/holds.t

+ 16
- 1
t/db_dependent/api/v1/holds.t View File

@@ -1136,7 +1136,7 @@ subtest 'add() tests' => sub {

subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {

plan tests => 16;
plan tests => 20;

$schema->storage->txn_begin;

@@ -1240,6 +1240,21 @@ subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {

is( $hold->discard_changes->branchcode->branchcode, $library_1->branchcode, 'pickup library unchanged' );

t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 );

# Attempt to use an invalid pickup locations with override succeeds
$t->put_ok( "//$userid:$password@/api/v1/holds/"
. $hold->id
. "/pickup_location"
=> { 'x-koha-override' => 'any' }
=> json => { pickup_library_id => $library_2->branchcode } )
->status_is(200)
->json_is({ pickup_library_id => $library_2->branchcode });

is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library changed' );

t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 );

$libraries_query = {
branchcode => {
'-in' => [ $library_1->branchcode, $library_2->branchcode ]


Loading…
Cancel
Save