LP 1306666: Test abort transit at org. unit other than copy owner. user/dyrcona/lp1306666-abort-transit-item-status
authorJason Stephenson <jstephenson@mvlcstaff.org>
Mon, 27 Jun 2016 13:02:32 +0000 (09:02 -0400)
committerJason Stephenson <jstephenson@mvlcstaff.org>
Mon, 27 Jun 2016 15:27:17 +0000 (11:27 -0400)
This should not change the copy status, even if the copy's status is
in transit.

Signed-off-by: Jason Stephenson <jstephenson@mvlcstaff.org>
Open-ILS/src/perlmods/live_t/19-lp1306666-abort-transit-copy-status.t

index fdf47d0..2eb06eb 100644 (file)
@@ -1,6 +1,6 @@
 #!perl
 use strict; use warnings;
-use Test::More tests => 26;
+use Test::More tests => 31;
 use OpenILS::Utils::TestUtils;
 use OpenILS::Const qw(:const);
 
@@ -234,7 +234,63 @@ $copy = $apputils->simplereq(
     $authtoken[0],
     $copy->id()
 );
-is($copy->status(), OILS_COPY_STATUS_IN_TRANSIT, 'Copy in transit 2');
+is($copy->status(), OILS_COPY_STATUS_IN_TRANSIT, 'Copy in transit');
+
+# Abort the transit at destination.
+$abort = $apputils->simplereq(
+    'open-ils.circ',
+    'open-ils.circ.transit.abort',
+    $authtoken[1],
+    {transitid => $transit->id()}
+);
+is($abort, 1, 'Transit aborted');
+
+# Check copy status.  It should be in transit.
+$copy = $apputils->simplereq(
+    'open-ils.pcrud',
+    'open-ils.pcrud.retrieve.acp',
+    $authtoken[0],
+    $copy->id()
+);
+is($copy->status(), OILS_COPY_STATUS_IN_TRANSIT, 'Copy in transit');
+
+# Check copy in at BR1
+$checkin = $apputils->simplereq(
+    'open-ils.circ',
+    'open-ils.circ.checkin',
+    $authtoken[0],
+    {barcode => CBARCODE}
+);
+subtest 'Got ROUTE_ITEM event 3' => sub {
+    plan tests => 3;
+    is(ref($checkin), 'HASH', 'Got event');
+    is($checkin->{textcode}, 'ROUTE_ITEM', 'Route item event');
+    is($checkin->{org}, BR3_ID, 'ROUTE_ITEM event destination');
+};
+
+# Check copy transit.
+$transit = $apputils->simplereq(
+    'open-ils.pcrud',
+    'open-ils.pcrud.search.ahtc',
+    $authtoken[0],
+    {target_copy => $copy->id(), hold => $hold->id(), dest_recv_time => undef}
+);
+subtest 'Got hold transit 3' => sub {
+    plan tests => 4;
+    isa_ok(ref($transit), 'Fieldmapper::action::hold_transit_copy', 'Got hold transit copy');
+    is($transit->dest(), BR3_ID, 'Transit destination');
+    is($transit->source(), BR1_ID, 'Transit source');
+    is($transit->copy_status(), OILS_COPY_STATUS_ON_HOLDS_SHELF, 'Transit copy status');
+};
+
+# Check copy status.
+$copy = $apputils->simplereq(
+    'open-ils.pcrud',
+    'open-ils.pcrud.retrieve.acp',
+    $authtoken[0],
+    $copy->id()
+);
+is($copy->status(), OILS_COPY_STATUS_IN_TRANSIT, 'Copy in transit 3');
 
 # Check copy in at BR3.
 $checkin = $apputils->simplereq(