From 7f87db6e8ec2969c64bd4c081b047b41d6989ca8 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sat, 8 Jan 2022 15:09:16 -0500 Subject: [PATCH] Add batch update test of mixed items --- .../src/perlmods/live_t/lp1883171-copy-inventory.t | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Open-ILS/src/perlmods/live_t/lp1883171-copy-inventory.t b/Open-ILS/src/perlmods/live_t/lp1883171-copy-inventory.t index 3a01714277..21be3f175c 100755 --- a/Open-ILS/src/perlmods/live_t/lp1883171-copy-inventory.t +++ b/Open-ILS/src/perlmods/live_t/lp1883171-copy-inventory.t @@ -354,6 +354,43 @@ if ($editor->update_asset_copy($fcopy)) { BAIL_OUT('Set copy floating failed'); } +# Test a batch update where some succeed and some fail. +$resp = $editor->search_asset_copy([ + {circ_lib => BR2_ID, status => 0, floating => undef}, + {limit => 5, idlist => 1} +]); +ok( + $resp && scalar(@{$resp}) == 5, + 'Got 5 copies from branch 2' +); +undef($copies); +push(@{$copies}, @{$resp}); +$resp = $editor->search_asset_copy([ + {circl_lib => BR1_ID, status => 0}, + {limit => 5, idlist => 1} +]); +ok( + $resp && scalar(@{$resp}) == 5, + 'Got 5 copies from branch 1' +); +push(@{$copies}, @{$resp}); +$resp = $U->simplereq( + 'open-ils.circ', + 'open-ils.circ.circulation.update_copy_inventory', + $authtoken, + {copy_list=>$copies} +); +is( + $resp->[0], + 5, + 'Updated inventory on 5 copies' +); +is( + $resp->[1], + 5, + 'Did not update inventory on 5 copies' +); + # We could run 36 or more tests depending on what we find in the # database, so we don't specify a number of tests. done_testing(); -- 2.11.0