sticking to the SIP2 spec for now
authorJason Etheridge <jason@EquinoxOLI.org>
Wed, 11 May 2022 17:39:40 +0000 (13:39 -0400)
committerJason Etheridge <jason@EquinoxOLI.org>
Thu, 26 May 2022 19:25:52 +0000 (15:25 -0400)
t/02patron_info.t

index 10d2e8b..58853e0 100755 (executable)
@@ -38,7 +38,7 @@ use SIPtest qw($datepat $textpat $instid $currency $user_barcode $user_pin
 my $patron_info_test_template = {
     id => 'valid Patron Info no details',
     msg => "6300020060329    201700          AO$instid|AA$user_barcode|",
-    pat => qr/^64 [ Y]{13}\d{3}$datepat(\d{4}){6}/,
+    pat => qr/^64[ Y]{14}\d{3}$datepat(\d{4}){6}/,
     fields => [
               $SIPtest::field_specs{(FID_INST_ID)   },
               $SIPtest::field_specs{(FID_SCREEN_MSG)},
@@ -65,13 +65,13 @@ my $patron_info_test_template = {
                 required => 0, },
               { field    => FID_HOME_ADDR,
                 pat      => qr/^$user_homeaddr$/o,
-                required => 1, }, # required by this test case
+                required => 0, }, # optional in the spec
               { field    => FID_EMAIL,
                 pat      => qr/^$user_email$/o,
                 required => 1, },
               { field    => FID_HOME_PHONE,
                 pat      => qr/^$user_phone$/o,
-                required => 1, },
+                required => 0, },
               { field    => FID_PATRON_BIRTHDATE,
                 pat      => qr/^$user_birthday$/o,
                 required => 1, },
@@ -80,10 +80,10 @@ my $patron_info_test_template = {
                 required => 1, },
               { field    => FID_INET_PROFILE,
                 pat      => qr/^$user_inet$/,
-                required => 1, },
+                required => 0, }, # this is a custom extension, not required by spec
               { field    => FID_HOME_LIBRARY,
                 pat      => qr/^$user_homelib$/,
-                required => 1, }, # Required for this test
+                required => 0, }, # this is a custom extension, not required by spec
              ], };
 
 my @tests = (
@@ -140,7 +140,7 @@ sub create_invalid_patron_tests {
     $test = clone($patron_info_test_template);
     $test->{id} = "invalid Patron Info id";
     $test->{msg} =~ s/AA$user_barcode\|/AAbad_barcode|/o;
-    $test->{pat} = qr/^64Y[ Y]{13}\d{3}$datepat(\d{4}){6}/;
+    $test->{pat} = qr/^64Y[ NY]{13}\d{3}$datepat(\d{4}){6}/;
     delete $test->{fields};
     $test->{fields} = [
         $SIPtest::field_specs{   (FID_INST_ID)  },
@@ -165,7 +165,7 @@ sub create_invalid_patron_tests {
     $test = clone($patron_info_test_template);
     $test->{id} = "valid Patron Info, invalid password";
     $test->{msg} .= (FID_PATRON_PWD) . 'badpwd|';
-    $test->{pat} = qr/^64[ Y]{14}\d{3}$datepat(\d{4}){6}/;
+    $test->{pat} = qr/^64[ YN]{14}\d{3}$datepat(\d{4}){6}/;
     delete $test->{fields};
     $test->{fields} = [
         $SIPtest::field_specs{   (FID_INST_ID)  },