From 8cf4b74094fe2ebeacdc64764bb158e7cbbc48e6 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Sat, 26 Nov 2022 09:00:17 -0500 Subject: [PATCH] test ILS defined protocol extensions Signed-off-by: Jason Etheridge --- t/17extensions.t | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- t/augment_concerto.sql | 17 +++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/t/17extensions.t b/t/17extensions.t index 4a6859c..7e3e81f 100755 --- a/t/17extensions.t +++ b/t/17extensions.t @@ -6,8 +6,9 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $instid $currency $user_barcode $user_pin - $user_fullname $user_homeaddr $user_email $user_phone - $user_birthday $user_ptype $user_inet $user_homelib); + $user_fullname $user_homeaddr $user_email $user_phone + $user_birthday $user_ptype $user_inet $user_homelib + $item_barcode $item_title $item_owner); my $patron_info_test_template = { id => 'valid Patron Info no details', @@ -89,11 +90,33 @@ my $patron_status_test_template = { ] }; +my $item_info_test_template = { + id => 'Item Information: check information for available item', + msg => "1720060110 215612AO$instid|AB$item_barcode|", + pat => qr/^180[139]0201$datepat/, # status of 'other' or 'available' + fields => [ + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_ITEM_ID, + pat => qr/^$item_barcode$/, + required => 1, }, + { field => FID_TITLE_ID, + pat => qr/^$item_title\s*$/, + required => 1, }, + { field => FID_MEDIA_TYPE, + pat => qr/^\d{3}$/, + required => 0, }, + { field => FID_OWNER, + pat => qr/^$item_owner$/, + required => 0, }, +], }; + my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, clone($patron_info_test_template), clone($patron_status_test_template), + clone($item_info_test_template), ); @@ -179,8 +202,31 @@ sub create_patron_status_extension_tests { } +sub create_ils_defined_protocol_extension_tests { + + # in Evergreen, these are the SIP Field entries with stat cats + + my $test = clone($patron_info_test_template); + $test->{id} = "Patron Info ILS defined extension"; + push @{$test->{fields}}, { + field => 'XX', + pat => qr/^abc$/o, + just_warn => 1, required => 1, }; + push @tests, $test; + + $test = clone($item_info_test_template); + $test->{id} = "Item Info ILS defined extension"; + push @{$test->{fields}}, { + field => 'YY', + pat => qr/^b1$/o, + just_warn => 1, required => 1, }; + push @tests, $test; + +} + create_patron_info_extension_tests(); create_patron_status_extension_tests(); +create_ils_defined_protocol_extension_tests(); SIPtest::run_sip_tests(@tests); diff --git a/t/augment_concerto.sql b/t/augment_concerto.sql index 76d58b8..26145b2 100644 --- a/t/augment_concerto.sql +++ b/t/augment_concerto.sql @@ -17,3 +17,20 @@ set where name = 'sip.sc_status_before_login_institution' ; + +INSERT INTO actor.stat_cat_sip_field (field, name, one_only) VALUES ('XX', 'Generic Unformatted Export', 'f'); +INSERT INTO asset.stat_cat_sip_field (field, name, one_only) VALUES ('YY', 'Generic Unformatted Export', 'f'); + +INSERT INTO actor.stat_cat (owner, name, opac_visible, usr_summary, sip_field, sip_format, checkout_archive, required, allow_freetext) + VALUES (1, 'test', 'f', 'f', 'XX', '', 'f', 'f', 't'); +INSERT INTO actor.stat_cat_entry_usr_map (stat_cat_entry, stat_cat, target_usr) + VALUES ('abc', 1, 71); + +INSERT INTO asset.stat_cat (owner, opac_visible, name, required, sip_field, checkout_archive) + VALUES (1, 'f', 'test', 'f', 'YY', '', 'f'); +INSERT INTO asset.stat_cat_entry(stat_cat, owner, value) + VALUES (1, 1, 'a1'), (1, 1, 'b1'); +INSERT INTO asset.stat_cat_entry_copy_map (stat_cat, stat_cat_entry, owning_copy) + VALUES (1, 2, 2003); + + -- 2.11.0