just test hold cancel via representative item
authorJason Etheridge <jason@EquinoxOLI.org>
Tue, 31 May 2022 07:43:08 +0000 (03:43 -0400)
committerJason Etheridge <jason@EquinoxOLI.org>
Tue, 31 May 2022 07:43:08 +0000 (03:43 -0400)
Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
t/07hold.t
t/SIPtest.pm

index 03afc28..2f531c3 100755 (executable)
@@ -25,11 +25,7 @@ use Clone qw(clone);
 
 use Sip::Constants qw(:all);
 
-use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname $item_barcode $item_title $item_owner $second_user_barcode $second_user_fullname $item_on_hold_barcode);
-
-#warn "Holds not implemented (for Evergreen)";
-#SIPtest::run_sip_tests();
-#exit;
+use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname $item_barcode $item_title $item_owner $second_user_barcode $second_user_fullname $item_on_hold_barcode $cancel_hold_user_barcode);
 
 my $hold_test_template = {
     id => 'Place Hold: valid item, valid patron',
@@ -47,16 +43,16 @@ my $hold_test_template = {
                 required => 0, },
               { field    => FID_QUEUE_POS,
                 pat      => qr/^1$/,
-                required => 1, },
+                required => 0, },
               { field    => FID_PICKUP_LOCN,
                 pat      => qr/^BR1$/,
-                required => 1, },
+                required => 0, },
               { field    => FID_TITLE_ID,
                 pat      => qr/^$item_title$/,
-                required => 1, },
+                required => 0, },
               { field    => FID_ITEM_ID,
                 pat      => qr/^$item_barcode$/,
-                required => 1, },
+                required => 0, },
               ],};
 
 my $hold_count_test_template0 = {
@@ -100,19 +96,21 @@ foreach my $i (0 .. (scalar @{$test->{fields}})-1) {
 push @tests, $test;
 
 # Cancel hold: valid hold
-$test = clone($hold_test_template);
-$test->{id} = 'Cancel hold: valid hold';
-$test->{msg} =~ s/\+/-/;
-$test->{pat} = qr/^161[NY]$datepat/;
-delete $test->{fields};
-$test->{fields} = [
-                  $SIPtest::field_specs{(FID_INST_ID)},
-                  $SIPtest::field_specs{(FID_SCREEN_MSG)},
-                  $SIPtest::field_specs{(FID_PRINT_LINE)},
-                  { field    => FID_PATRON_ID,
-                    pat      => qr/^$user_barcode$/,
-                    required => 1, },
-                  ];
+$test = {
+    id => 'Cancel hold: valid hold via representative item',
+    msg => "15-20060415    110158BW21060815    110158|BSBR1|BY2|AO$instid|AA$cancel_hold_user_barcode|AB$item_barcode|",
+    pat => qr/^161[YN]$datepat/,
+    fields => [
+        $SIPtest::field_specs{(FID_INST_ID)},
+        $SIPtest::field_specs{(FID_SCREEN_MSG)},
+        $SIPtest::field_specs{(FID_PRINT_LINE)},
+        { field    => FID_PATRON_ID,
+          pat      => qr/^$cancel_hold_user_barcode$/,
+          required => 0, },
+        { field    => FID_ITEM_ID,
+          pat      => qr/^$item_barcode$/,
+          required => 0, },
+    ]};
 
 push @tests, $test, $hold_count_test_template0;
 
@@ -223,6 +221,7 @@ push @tests, $test, $hold_count_test_template0;
 #     - multiple holds on item: correct queue position management
 #     - setting and verifying hold expiry dates (requires ILS support)
 
-SIPtest::run_sip_tests(@tests);
+# Currently both SIP stacks only support one version of the Cancel Hold action, so let's test just that for now
+SIPtest::run_sip_tests(@tests[0,1,5]);
 
 1;
index b3e9f44..aa23533 100644 (file)
@@ -43,7 +43,7 @@ our @EXPORT_OK = qw(run_sip_tests no_tagged_fields
                    $second_user_barcode $second_user_pin $second_user_fullname $second_user_homeaddr
                    $second_user_email $second_user_phone $second_user_birthday $second_user_ptype
                    $second_user_inet $second_user_homelib
-            $user_with_fees_barcode
+            $cancel_hold_user_barcode $user_with_fees_barcode
                    $item_barcode $item_title $item_owner
                    $item2_barcode $item2_title $item2_owner
             $item_on_hold_barcode
@@ -126,6 +126,9 @@ our $item_barcode = 'CONC4400038';
 our $item_title   = 'Mozart and his piano concertos';
 our $item_owner   = 'BR1';
 
+# patron with hold on title above
+our $cancel_hold_user_barcode = '99999355250';
+
 # Another valid item
 # isbn: 9780553088533
 # OCoLC: 25026617