From 309aa9464f9808be6e2e3fcb683bc2ffafdff635 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 24 Nov 2022 11:04:25 -0500 Subject: [PATCH] test Relais extensions --- t/17extensions.t | 80 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 9 deletions(-) diff --git a/t/17extensions.t b/t/17extensions.t index b65d69e..4a6859c 100755 --- a/t/17extensions.t +++ b/t/17extensions.t @@ -37,7 +37,7 @@ my $patron_info_test_template = { { field => FID_FEE_LMT, pat => $textpat, required => 0, }, - # field => FID_HOME_ADDR, + #{ field => FID_HOME_ADDR, # pat => qr/^$user_homeaddr$/o, # required => 1, }, # required by this test case { field => FID_EMAIL, @@ -55,26 +55,56 @@ my $patron_info_test_template = { #{ field => FID_INET_PROFILE, # pat => qr/^$user_inet$/, # required => 1, }, - # field => FID_HOME_LIBRARY, + #{ field => FID_HOME_LIBRARY, # pat => qr/^$user_homelib$/, # required => 1, }, # Required for this test ], }; +my $patron_status_test_template = { + id => 'valid Patron Status', + msg => "2300120060101 084237AO$SIPtest::instid|AA$user_barcode|AD$user_pin|AC|", + pat => qr/^24 [ Y]{13}\d{3}$datepat/, + fields => [ + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PERSONAL_NAME, + pat => qr/^$user_fullname$/o, + required => 1, }, + { field => FID_PATRON_ID, + pat => qr/^$user_barcode/o, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + required => 0, }, + { field => FID_VALID_PATRON_PWD, + pat => qr/^Y$/, + required => 0, }, + { field => FID_CURRENCY, + pat => qr/^$currency$/io, + required => 0, }, + { field => FID_FEE_AMT, + pat => qr/^[0-9.]+$/, + required => 0, }, + ] +}; + my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, clone($patron_info_test_template), + clone($patron_status_test_template), ); sub create_patron_info_extension_tests { - my $test = clone($patron_info_test_template); + my $test = clone($patron_info_test_template); $test->{id} = "Patron Info home address extension"; push @{$test->{fields}}, { field => FID_HOME_ADDR, pat => qr/^$user_homeaddr$/o, - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; $test = clone($patron_info_test_template); @@ -82,7 +112,7 @@ sub create_patron_info_extension_tests { push @{$test->{fields}}, { field => FID_INET_PROFILE, pat => qr/^$user_inet$/, - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; $test = clone($patron_info_test_template); @@ -90,7 +120,7 @@ sub create_patron_info_extension_tests { push @{$test->{fields}}, { field => FID_HOME_LIBRARY, pat => qr/^$user_homelib$/, - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; $test = clone($patron_info_test_template); @@ -98,7 +128,7 @@ sub create_patron_info_extension_tests { push @{$test->{fields}}, { field => FID_PATRON_BIRTHDATE, pat => qr/^$user_birthday$/o, - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; $test = clone($patron_info_test_template); @@ -106,7 +136,7 @@ sub create_patron_info_extension_tests { push @{$test->{fields}}, { field => FID_PATRON_CLASS, pat => qr/^$user_ptype$/o, - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; $test = clone($patron_info_test_template); @@ -114,11 +144,43 @@ sub create_patron_info_extension_tests { push @{$test->{fields}}, { field => FID_PATRON_EXPIRE, pat => qr/^20\d\d\d\d\d\d$/o, # presumably this date format works for Envisionware - required => 1, }; + just_warn => 1, required => 1, }; push @tests, $test; } +sub create_patron_status_extension_tests { + + # with SIPServer, add to the institution config + # to test these + + my $test = clone($patron_status_test_template); + $test->{id} = "Patron Status home address extension"; + push @{$test->{fields}}, { + field => FID_HOME_ADDR, + pat => qr/^$user_homeaddr$/o, + just_warn => 1, required => 1, }; + push @tests, $test; + + $test = clone($patron_status_test_template); + $test->{id} = "Patron Status email address extension"; + push @{$test->{fields}}, { + field => FID_EMAIL, + pat => qr/^$user_email$/o, + just_warn => 1, required => 1, }; + push @tests, $test; + + $test = clone($patron_status_test_template); + $test->{id} = "Patron Status home phone extension"; + push @{$test->{fields}}, { + field => FID_HOME_PHONE, + pat => qr/^$user_phone$/o, + just_warn => 1, required => 1, }; + push @tests, $test; + +} + create_patron_info_extension_tests(); +create_patron_status_extension_tests(); SIPtest::run_sip_tests(@tests); -- 2.11.0