From fa24c92bf87d4c3f8152caafd114de7807660287 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Wed, 23 Nov 2022 21:59:23 -0500 Subject: [PATCH] tabs to spaces This is going to cause some poor indentation, but I'm tired of tripping over these tabs :) Signed-off-by: Jason Etheridge --- t/00sc_status.t | 12 ++-- t/01patron_status.t | 130 +++++++++++++++++++++--------------------- t/02patron_info.t | 132 +++++++++++++++++++++---------------------- t/03checkout.t | 116 +++++++++++++++++++------------------- t/04patron_status.t | 102 ++++++++++++++++----------------- t/05block_patron.t | 44 +++++++-------- t/06patron_enable.t | 158 ++++++++++++++++++++++++++-------------------------- t/07hold.t | 132 +++++++++++++++++++++---------------------- t/08checkin.t | 44 +++++++-------- t/09renew.t | 114 ++++++++++++++++++------------------- t/10renew_all.t | 84 ++++++++++++++-------------- t/11item_info.t | 40 ++++++------- t/12end_session.t | 6 +- t/13fee_paid.t | 12 ++-- t/SIPtest.pm | 78 +++++++++++++------------- 15 files changed, 602 insertions(+), 602 deletions(-) diff --git a/t/00sc_status.t b/t/00sc_status.t index 5729feb..1a07115 100755 --- a/t/00sc_status.t +++ b/t/00sc_status.t @@ -27,14 +27,14 @@ use warnings; use SIPtest qw($datepat $username $password $login_test $sc_status_test); my $invalid_uname = { id => 'Invalid username', - msg => "9300CNinvalid$username|CO$password|CPThe floor|", - pat => qr/^940/, - fields => [], }; + msg => "9300CNinvalid$username|CO$password|CPThe floor|", + pat => qr/^940/, + fields => [], }; my $invalid_pwd = { id => 'Invalid password', - msg => "9300CN$username|COinvalid$password|CPThe floor|", - pat => qr/^940/, - fields => [], }; + msg => "9300CN$username|COinvalid$password|CPThe floor|", + pat => qr/^940/, + fields => [], }; my @tests = ( $invalid_uname, $invalid_pwd, $login_test, $sc_status_test ); diff --git a/t/01patron_status.t b/t/01patron_status.t index d36fda4..32ef35b 100755 --- a/t/01patron_status.t +++ b/t/01patron_status.t @@ -24,73 +24,73 @@ use warnings; use Sip::Constants qw(:all); use SIPtest qw($datepat $instid $currency $user_barcode $user_pin - $user_fullname $user_homeaddr $user_email $user_phone - $user_birthday); + $user_fullname $user_homeaddr $user_email $user_phone + $user_birthday); my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - { 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, }, - ], }, - { id => 'invalid password Patron Status', - msg => "2300120060101 084237AO$instid|AA$user_barcode|AC|ADbadw|", - pat => qr/^24[ Y]{14}\d{3}$datepat/, - fields => [ - { field => FID_PERSONAL_NAME, - pat => qr/^$user_fullname$/o, - required => 1, }, - { field => FID_PATRON_ID, - pat => qr/^$user_barcode$/o, - required => 1, }, - { field => FID_INST_ID, - pat => qr/^$instid$/o, - required => 1, }, - { field => FID_VALID_PATRON_PWD, - pat => qr/^N$/, - required => 0, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - required => 0, }, - ], }, - { id => 'invalid Patron Status', - msg => "2300120060101 084237AO$instid|AAwshakespeare|AC|", - pat => qr/^24Y[ Y]{13}\d{3}$datepat/, - fields => [ - { field => FID_PERSONAL_NAME, - pat => qr/^$/, - required => 1, }, - { field => FID_PATRON_ID, - pat => qr/^wshakespeare$/, - required => 1, }, - { field => FID_INST_ID, - pat => qr/^$instid$/o, - required => 1, }, - ], }, - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + { 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, }, + ], }, + { id => 'invalid password Patron Status', + msg => "2300120060101 084237AO$instid|AA$user_barcode|AC|ADbadw|", + pat => qr/^24[ Y]{14}\d{3}$datepat/, + fields => [ + { field => FID_PERSONAL_NAME, + pat => qr/^$user_fullname$/o, + required => 1, }, + { field => FID_PATRON_ID, + pat => qr/^$user_barcode$/o, + required => 1, }, + { field => FID_INST_ID, + pat => qr/^$instid$/o, + required => 1, }, + { field => FID_VALID_PATRON_PWD, + pat => qr/^N$/, + required => 0, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + required => 0, }, + ], }, + { id => 'invalid Patron Status', + msg => "2300120060101 084237AO$instid|AAwshakespeare|AC|", + pat => qr/^24Y[ Y]{13}\d{3}$datepat/, + fields => [ + { field => FID_PERSONAL_NAME, + pat => qr/^$/, + required => 1, }, + { field => FID_PATRON_ID, + pat => qr/^wshakespeare$/, + required => 1, }, + { field => FID_INST_ID, + pat => qr/^$instid$/o, + required => 1, }, + ], }, + ); SIPtest::run_sip_tests(@tests); diff --git a/t/02patron_info.t b/t/02patron_info.t index e10ec5e..b33e149 100755 --- a/t/02patron_info.t +++ b/t/02patron_info.t @@ -26,8 +26,8 @@ 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); # This is a template test case for the Patron Information # message handling. Because of the large number of fields, @@ -40,51 +40,51 @@ my $patron_info_test_template = { msg => "6300020060329 201700 AO$instid|AA$user_barcode|", pat => qr/^64[ Y]{14}\d{3}$datepat(\d{4}){6}/, 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$/o, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$user_fullname$/o, - required => 1, just_warn => 1, }, - $SIPtest::field_specs{(FID_HOLD_ITEMS_LMT) }, - $SIPtest::field_specs{(FID_OVERDUE_ITEMS_LMT)}, - $SIPtest::field_specs{(FID_CHARGED_ITEMS_LMT)}, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - $SIPtest::field_specs{(FID_CURRENCY)}, - { field => FID_FEE_AMT, - pat => $textpat, - required => 0, }, - { field => FID_FEE_LMT, - pat => $textpat, - required => 0, }, - { field => FID_HOME_ADDR, - pat => qr/^$user_homeaddr$/o, - 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 => 0, }, - { field => FID_PATRON_BIRTHDATE, - pat => qr/^$user_birthday$/o, - required => 1, }, - { field => FID_PATRON_CLASS, - pat => qr/^$user_ptype$/o, - required => 1, }, - { field => FID_INET_PROFILE, - pat => qr/^$user_inet$/, - required => 0, }, # this is a custom extension, not required by spec - { field => FID_HOME_LIBRARY, - pat => qr/^$user_homelib$/, - required => 0, }, # this is a custom extension, not required by spec - ], }; + $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$/o, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$user_fullname$/o, + required => 1, just_warn => 1, }, + $SIPtest::field_specs{(FID_HOLD_ITEMS_LMT) }, + $SIPtest::field_specs{(FID_OVERDUE_ITEMS_LMT)}, + $SIPtest::field_specs{(FID_CHARGED_ITEMS_LMT)}, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + $SIPtest::field_specs{(FID_CURRENCY)}, + { field => FID_FEE_AMT, + pat => $textpat, + required => 0, }, + { field => FID_FEE_LMT, + pat => $textpat, + required => 0, }, + { field => FID_HOME_ADDR, + pat => qr/^$user_homeaddr$/o, + 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 => 0, }, + { field => FID_PATRON_BIRTHDATE, + pat => qr/^$user_birthday$/o, + required => 1, }, + { field => FID_PATRON_CLASS, + pat => qr/^$user_ptype$/o, + required => 1, }, + { field => FID_INET_PROFILE, + pat => qr/^$user_inet$/, + required => 0, }, # this is a custom extension, not required by spec + { field => FID_HOME_LIBRARY, + pat => qr/^$user_homelib$/, + required => 0, }, # this is a custom extension, not required by spec + ], }; my @tests = ( $SIPtest::login_test, @@ -97,26 +97,26 @@ my @tests = ( sub create_patron_summary_tests { my $test; my @patron_info_summary_tests = ( - { field => FID_HOLD_ITEMS, - pat => $textpat, - required => 0, }, - { field => FID_OVERDUE_ITEMS, - pat => $textpat, - required => 0, }, - { field => FID_CHARGED_ITEMS, - pat => $textpat, - required => 0, }, + { field => FID_HOLD_ITEMS, + pat => $textpat, + required => 0, }, + { field => FID_OVERDUE_ITEMS, + pat => $textpat, + required => 0, }, + { field => FID_CHARGED_ITEMS, + pat => $textpat, + required => 0, }, # The test user has no items of these types, so the tests seem to fail -# { field => FID_FINE_ITEMS, -# pat => $textpat, -# required => 1, }, -# { field => FID_RECALL_ITEMS, -# pat => $textpat, -# required => 0, }, -# { field => FID_UNAVAILABLE_HOLD_ITEMS, -# pat => $textpat, -# required => 0, }, - ); +# { field => FID_FINE_ITEMS, +# pat => $textpat, +# required => 1, }, +# { field => FID_RECALL_ITEMS, +# pat => $textpat, +# required => 0, }, +# { field => FID_UNAVAILABLE_HOLD_ITEMS, +# pat => $textpat, +# required => 0, }, + ); foreach my $i (0 .. scalar @patron_info_summary_tests-1) { # The tests for each of the summary fields are exactly the diff --git a/t/03checkout.t b/t/03checkout.t index a6abbc8..7702b03 100755 --- a/t/03checkout.t +++ b/t/03checkout.t @@ -26,9 +26,9 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $instid $currency $user_barcode - $item_barcode $item_title - $item_diacritic_barcode $item_diacritic_title - $item_diacritic_owner); + $item_barcode $item_title + $item_diacritic_barcode $item_diacritic_title + $item_diacritic_owner); my $patron_enable_template = { id => 'Renew All: prep: enable patron permissions', @@ -57,50 +57,50 @@ my $checkout_test_template = { msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", pat => qr/^121NNY$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/^$user_barcode$/o, - required => 1, }, - { field => FID_ITEM_ID, - pat => qr/^$item_barcode$/o, - required => 1, }, - { field => FID_TITLE_ID, - pat => qr/^$item_title\s*$/o, - required => 1, }, - { field => FID_DUE_DATE, - pat => $textpat, - required => 1, }, - { field => FID_FEE_TYPE, - pat => qr/^\d{2}$/, - required => 0, }, - { field => FID_SECURITY_INHIBIT, - pat => qr/^[YN]$/, - required => 0, }, - { field => FID_CURRENCY, - pat => qr/^$currency$/o, - required => 0, }, - { field => FID_FEE_AMT, - pat => qr/^[.0-9]+$/, - required => 0, }, - { field => FID_MEDIA_TYPE, - pat => qr/^\d{3}$/, - required => 0, }, - { field => FID_ITEM_PROPS, - pat => $textpat, - required => 0, }, - { field => FID_TRANSACTION_ID, - pat => $textpat, - required => 0, }, - ], }; + $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$/o, + required => 1, }, + { field => FID_ITEM_ID, + pat => qr/^$item_barcode$/o, + required => 1, }, + { field => FID_TITLE_ID, + pat => qr/^$item_title\s*$/o, + required => 1, }, + { field => FID_DUE_DATE, + pat => $textpat, + required => 1, }, + { field => FID_FEE_TYPE, + pat => qr/^\d{2}$/, + required => 0, }, + { field => FID_SECURITY_INHIBIT, + pat => qr/^[YN]$/, + required => 0, }, + { field => FID_CURRENCY, + pat => qr/^$currency$/o, + required => 0, }, + { field => FID_FEE_AMT, + pat => qr/^[.0-9]+$/, + required => 0, }, + { field => FID_MEDIA_TYPE, + pat => qr/^\d{3}$/, + required => 0, }, + { field => FID_ITEM_PROPS, + pat => $textpat, + required => 0, }, + { field => FID_TRANSACTION_ID, + pat => $textpat, + required => 0, }, + ], }; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - clone($checkout_test_template), - # Don't check the item in, because we're about to test renew - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + clone($checkout_test_template), + # Don't check the item in, because we're about to test renew + ); my $test; @@ -128,11 +128,11 @@ foreach my $i (0 .. (scalar @{$test->{fields}})-1) { my $field = $test->{fields}[$i]; if ($field->{field} eq FID_ITEM_ID) { - $field->{pat} = qr/^$item_diacritic_barcode$/; + $field->{pat} = qr/^$item_diacritic_barcode$/; } elsif ($field->{field} eq FID_TITLE_ID) { - $field->{pat} = qr/^$item_diacritic_title\s*$/; + $field->{pat} = qr/^$item_diacritic_title\s*$/; } elsif ($field->{field} eq FID_OWNER) { - $field->{pat} = qr/^$item_diacritic_owner$/; + $field->{pat} = qr/^$item_diacritic_owner$/; } } @@ -204,16 +204,16 @@ push @tests, $test; #$test->{pat} = qr/^120NUN$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, }, -# { field => FID_VALID_PATRON, -# pat => qr/^Y$/, -# required => 1, }, -# ]; +# $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, }, +# { field => FID_VALID_PATRON, +# pat => qr/^Y$/, +# required => 1, }, +# ]; # #push @tests, $patron_disable_template, $test, $patron_enable_template; # diff --git a/t/04patron_status.t b/t/04patron_status.t index bb1fcc5..32dcc03 100755 --- a/t/04patron_status.t +++ b/t/04patron_status.t @@ -26,39 +26,39 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $instid $currency $user_barcode $user_pin - $user_fullname $user_homeaddr $user_email $user_phone + $user_fullname $user_homeaddr $user_email $user_phone $textpat $password - $user_birthday); + $user_birthday); my $patron_status_test_template = { id => 'Patron Status: valid patron, no patron password', msg => "2300120060101 084237AO$instid|AA$user_barcode|AC$password|", pat => qr/^24 [ Y]{13}00[01]$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/^$user_barcode$/, - required => 1, }, - { field => FID_PERSONAL_NAME, + $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, }, + { field => FID_PERSONAL_NAME, pat => qr/^$user_fullname$/o, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - $SIPtest::field_specs{(FID_CURRENCY)}, - { field => FID_FEE_AMT, - pat => $textpat, - required => 0, }, - ], }; + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + $SIPtest::field_specs{(FID_CURRENCY)}, + { field => FID_FEE_AMT, + pat => $textpat, + required => 0, }, + ], }; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - clone($patron_status_test_template), - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + clone($patron_status_test_template), + ); # Invalid patron my $test = clone($patron_status_test_template); @@ -70,19 +70,19 @@ $test->{pat} = qr/^24Y[ Y]{13}00[01]$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/^bad_userid$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^N$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^bad_userid$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^N$/, + required => 1, }, + ]; push @tests, $test; @@ -93,23 +93,23 @@ $test->{msg} .= (FID_PATRON_PWD) . 'badpwd|'; $test->{pat} = qr/^24[ Y]{14}00[01]$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, }, - { field => FID_PERSONAL_NAME, + $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, }, + { field => FID_PERSONAL_NAME, pat => qr/^$/o, # FIXME: expose patron info with invalid password or not? - required => 1, + required => 1, just_warn => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^N$/, # FIXME: still exposing patron info if we provide Y here with an invalid password - required => 0, }, # optional per spec - { field => FID_VALID_PATRON_PWD, - pat => qr/^N$/, - required => 0, }, # optional per spec - ]; + { field => FID_VALID_PATRON, + pat => qr/^N$/, # FIXME: still exposing patron info if we provide Y here with an invalid password + required => 0, }, # optional per spec + { field => FID_VALID_PATRON_PWD, + pat => qr/^N$/, + required => 0, }, # optional per spec + ]; push @tests, $test; # TODO: Need multiple patrons to test each individual diff --git a/t/05block_patron.t b/t/05block_patron.t index 845515a..565b128 100755 --- a/t/05block_patron.t +++ b/t/05block_patron.t @@ -33,30 +33,30 @@ my $block_patron_test_template = { # response to block patron is a patron status message pat => qr/^24Y[ Y]{13}000$datepat/o, 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/^$block_user_barcode$/o, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$block_user_fullname$/o, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - $SIPtest::field_specs{(FID_CURRENCY)}, - { field => FID_FEE_AMT, - pat => $textpat, - required => 0, }, - ], }; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$block_user_barcode$/o, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$block_user_fullname$/o, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + $SIPtest::field_specs{(FID_CURRENCY)}, + { field => FID_FEE_AMT, + pat => $textpat, + required => 0, }, + ], }; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - clone($block_patron_test_template), - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + clone($block_patron_test_template), + ); SIPtest::run_sip_tests(@tests); diff --git a/t/06patron_enable.t b/t/06patron_enable.t index 02efc19..95fba0a 100755 --- a/t/06patron_enable.t +++ b/t/06patron_enable.t @@ -32,20 +32,20 @@ my $patron_enable_test_template = { msg => "2520060102 084238AO$instid|AA$block_user_barcode|", pat => qr/^26 [ Y]{12}000$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/^$block_user_barcode$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$block_user_fullname$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - ], }; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$block_user_barcode$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$block_user_fullname$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + ], }; # We need to disable the valid patron before we can # ensure that he was properly enabled. @@ -55,25 +55,25 @@ my $patron_disable_test_template = { # response to block patron is a patron status message pat => qr/^24Y{4}[ Y]{10}000$datepat/, fields => [ - $SIPtest::field_specs{(FID_INST_ID)}, - { field => FID_PATRON_ID, - pat => qr/^$block_user_barcode$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$block_user_fullname$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - ], }; + $SIPtest::field_specs{(FID_INST_ID)}, + { field => FID_PATRON_ID, + pat => qr/^$block_user_barcode$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$block_user_fullname$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + ], }; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - $patron_disable_test_template, - clone($patron_enable_test_template), - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + $patron_disable_test_template, + clone($patron_enable_test_template), + ); my $test; @@ -84,23 +84,23 @@ $test->{msg} .= FID_PATRON_PWD . '6789|'; $test->{pat} = qr/^26 {4}[ Y]{10}000$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/^$block_user_barcode$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$block_user_fullname$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - { field => FID_VALID_PATRON_PWD, - pat => qr/^Y$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$block_user_barcode$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$block_user_fullname$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + { field => FID_VALID_PATRON_PWD, + pat => qr/^Y$/, + required => 1, }, + ]; push @tests, $patron_disable_test_template, $test; @@ -111,23 +111,23 @@ $test->{msg} .= FID_PATRON_PWD . 'bad password|'; $test->{pat} = qr/^26[ Y]{14}000$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/^$block_user_barcode$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$block_user_fullname$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^Y$/, - # Not required by the spec, but by the test - required => 1, }, - { field => FID_VALID_PATRON_PWD, - pat => qr/^N$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$block_user_barcode$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$block_user_fullname$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^Y$/, + # Not required by the spec, but by the test + required => 1, }, + { field => FID_VALID_PATRON_PWD, + pat => qr/^N$/, + required => 1, }, + ]; push @tests, $patron_disable_test_template, $test; # After this test, the patron is left disabled, so re-enable @@ -140,20 +140,20 @@ $test->{msg} =~ s/AA$block_user_barcode\|/AAbad_userid|/; $test->{pat} = qr/^26Y{4}[ Y]{10}000$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/^bad_userid$/, - required => 1, }, - { field => FID_PERSONAL_NAME, - pat => qr/^$/, - required => 1, }, - { field => FID_VALID_PATRON, - pat => qr/^N$/, - # Not required by the spec, but by the test - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^bad_userid$/, + required => 1, }, + { field => FID_PERSONAL_NAME, + pat => qr/^$/, + required => 1, }, + { field => FID_VALID_PATRON, + pat => qr/^N$/, + # Not required by the spec, but by the test + required => 1, }, + ]; push @tests, $test; diff --git a/t/07hold.t b/t/07hold.t index fd31f54..5f2a0a2 100755 --- a/t/07hold.t +++ b/t/07hold.t @@ -32,28 +32,28 @@ my $hold_test_template = { msg => "15+20060415 110158BW21060815 110158|BSBR1|BY2|AO$instid|AA$user_barcode|AB$item_barcode|", pat => qr/^161N$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/^$user_barcode$/, - required => 1, }, - { field => FID_EXPIRATION, - pat => $datepat, - required => 0, }, - { field => FID_QUEUE_POS, - pat => qr/^1$/, - required => 0, }, - { field => FID_PICKUP_LOCN, - pat => qr/^BR1$/, - required => 0, }, - { field => FID_TITLE_ID, - pat => qr/^$item_title$/, - required => 0, }, - { field => FID_ITEM_ID, - pat => qr/^$item_barcode$/, - required => 0, }, - ],}; + $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, }, + { field => FID_EXPIRATION, + pat => $datepat, + required => 0, }, + { field => FID_QUEUE_POS, + pat => qr/^1$/, + required => 0, }, + { field => FID_PICKUP_LOCN, + pat => qr/^BR1$/, + required => 0, }, + { field => FID_TITLE_ID, + pat => qr/^$item_title$/, + required => 0, }, + { field => FID_ITEM_ID, + pat => qr/^$item_barcode$/, + required => 0, }, + ],}; my $hold_count_test_template0 = { id => 'Confirm patron has 0 holds', @@ -71,10 +71,10 @@ my $hold_count_test_template1 = { my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - $hold_test_template, $hold_count_test_template1, - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + $hold_test_template, $hold_count_test_template1, + ); my $test; @@ -87,9 +87,9 @@ foreach my $i (0 .. (scalar @{$test->{fields}})-1) { my $field = $test->{fields}[$i]; if ($field->{field} eq FID_PATRON_ID) { - $field->{pat} = qr/^$second_user_barcode$/; + $field->{pat} = qr/^$second_user_barcode$/; } elsif ($field->{field} eq FID_QUEUE_POS) { - $field->{pat} = qr/^2$/; + $field->{pat} = qr/^2$/; } } @@ -131,13 +131,13 @@ $test->{msg} =~ s/$user_barcode/$second_user_barcode/; $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/^$second_user_barcode$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$second_user_barcode$/, + required => 1, }, + ]; push @tests, $test; @@ -150,13 +150,13 @@ $test->{msg} =~ s/$item_barcode/$item_on_hold_barcode/; $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/^$second_user_barcode$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^$second_user_barcode$/, + required => 1, }, + ]; push @tests, $test; @@ -167,13 +167,13 @@ $test->{msg} .= FID_PATRON_PWD . 'bad password|'; $test->{pat} = qr/^160N$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, }, - ]; + $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, }, + ]; push @tests, $test, $hold_count_test_template0; @@ -184,13 +184,13 @@ $test->{msg} =~ s/AA$user_barcode\|/AAno_such_user|/; $test->{pat} = qr/^160N$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/^no_such_user$/, - required => 1, }, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_PATRON_ID, + pat => qr/^no_such_user$/, + required => 1, }, + ]; # There's no patron to check the number of holds against push @tests, $test; @@ -202,16 +202,16 @@ $test->{msg} =~ s/AB$item_barcode\|/ABnosuchitem|/; $test->{pat} = qr/^160N$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, }, - { field => FID_ITEM_ID, - pat => qr/^nosuchitem$/, - required => 0, }, - ]; + $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, }, + { field => FID_ITEM_ID, + pat => qr/^nosuchitem$/, + required => 0, }, + ]; push @tests, $test, $hold_count_test_template0; diff --git a/t/08checkin.t b/t/08checkin.t index 52d543b..20ce63d 100755 --- a/t/08checkin.t +++ b/t/08checkin.t @@ -26,29 +26,29 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $instid $user_barcode - $item_barcode $item_title); + $item_barcode $item_title); my $checkin_test_template = { id => 'Checkin: Item is checked out', msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|", pat => qr/^101YNN$datepat/o, 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$/o, - required => 1, }, - { field => FID_ITEM_ID, - pat => qr/^$item_barcode$/o, - required => 1, }, - { field => FID_PERM_LOCN, - pat => $textpat, - required => 1, }, - { field => FID_TITLE_ID, - pat => qr/^$item_title\s*$/o, - required => 1, }, # not required by the spec. - ],}; + $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$/o, + required => 1, }, + { field => FID_ITEM_ID, + pat => qr/^$item_barcode$/o, + required => 1, }, + { field => FID_PERM_LOCN, + pat => $textpat, + required => 1, }, + { field => FID_TITLE_ID, + pat => qr/^$item_title\s*$/o, + required => 1, }, # not required by the spec. + ],}; my $checkout_template = { id => 'Checkin: prep: check out item', @@ -58,11 +58,11 @@ my $checkout_template = { }; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - $checkout_template, - $checkin_test_template, - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + $checkout_template, + $checkin_test_template, + ); my $test; diff --git a/t/09renew.t b/t/09renew.t index eb1448c..a3ae170 100755 --- a/t/09renew.t +++ b/t/09renew.t @@ -26,68 +26,68 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $instid $currency $user_barcode - $item_barcode $item_title); + $item_barcode $item_title); my $checkout_template = { - id => 'Renew: prep: check out item', - msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", - pat => qr/^121NNY$datepat/, - fields => [], - }; + id => 'Renew: prep: check out item', + msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", + pat => qr/^121NNY$datepat/, + fields => [], + }; my $checkin_template = { - id => 'Renew: prep: check in item', - msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|", - pat => qr/^101YNN$datepat/, - fields => [], - }; + id => 'Renew: prep: check in item', + msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|", + pat => qr/^101YNN$datepat/, + fields => [], + }; #my $hold_template = { -# id => 'Renew: prep: place hold on item', -# msg =>"15+20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$second_user_barcode|AB$item_barcode|", -# pat => qr/^161N$datepat/, -# fields => [], -# }; +# id => 'Renew: prep: place hold on item', +# msg =>"15+20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$second_user_barcode|AB$item_barcode|", +# pat => qr/^161N$datepat/, +# fields => [], +# }; # #my $cancel_hold_template = { -# id => 'Renew: cleanup: cancel hold on item', -# msg =>"15-20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$second_user_barcode|AB$item_barcode|", -# pat => qr/^161[NY]$datepat/, -# fields => [], -# }; +# id => 'Renew: cleanup: cancel hold on item', +# msg =>"15-20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$second_user_barcode|AB$item_barcode|", +# pat => qr/^161[NY]$datepat/, +# fields => [], +# }; # my $renew_test_template = { - id => 'Renew: item id checked out to patron, renewal permitted, no 3rd party, no fees', - msg => "29NN20060102 084236 AO$instid|AA$user_barcode|AB$item_barcode|", - pat => qr/^301YNN$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/^$user_barcode$/, - required => 1, }, - { field => FID_ITEM_ID, - pat => qr/^$item_barcode$/, - required => 1, }, - { field => FID_TITLE_ID, - pat => qr/^$item_title\s*$/, - required => 1, }, - { field => FID_DUE_DATE, - pat => qr/^.+$/, # spec says ACS can return dates in any format it wants - required => 1, }, - { field => FID_SECURITY_INHIBIT, - pat => qr/^[YN]$/, - required => 0, }, - ],}; + id => 'Renew: item id checked out to patron, renewal permitted, no 3rd party, no fees', + msg => "29NN20060102 084236 AO$instid|AA$user_barcode|AB$item_barcode|", + pat => qr/^301YNN$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/^$user_barcode$/, + required => 1, }, + { field => FID_ITEM_ID, + pat => qr/^$item_barcode$/, + required => 1, }, + { field => FID_TITLE_ID, + pat => qr/^$item_title\s*$/, + required => 1, }, + { field => FID_DUE_DATE, + pat => qr/^.+$/, # spec says ACS can return dates in any format it wants + required => 1, }, + { field => FID_SECURITY_INHIBIT, + pat => qr/^[YN]$/, + required => 0, }, + ],}; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, - $checkout_template, - $renew_test_template, - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + $checkout_template, + $renew_test_template, + ); my $test; @@ -104,7 +104,7 @@ my $test; #$test->{pat} = qr/^300N[NU]N$datepat/; #foreach my $field (@{$test->{fields}}) { # if ($field->{field} eq FID_DUE_DATE || $field->{field} eq FID_TITLE_ID) { -# $field->{pat} = qr/^$/; +# $field->{pat} = qr/^$/; # } #} # @@ -117,9 +117,9 @@ $test->{id} = 'Renew: item not checked out at all'; $test->{pat} = qr/^300N[NU]N$datepat/; foreach my $field (@{$test->{fields}}) { if ($field->{field} eq FID_DUE_DATE) { - $field->{pat} = qr/^$/; + $field->{pat} = qr/^$/; } elsif ($field->{field} eq FID_TITLE_ID) { - $field->{pat} = qr/^($item_title\s*|)$/; + $field->{pat} = qr/^($item_title\s*|)$/; } } @@ -131,9 +131,9 @@ $test->{msg} =~ s/AB[^|]+/ABbad-item/; $test->{pat} = qr/^300N[NU]N$datepat/; foreach my $field (@{$test->{fields}}) { if ($field->{field} eq FID_TITLE_ID || $field->{field} eq FID_DUE_DATE) { - $field->{pat} = qr/^$/; + $field->{pat} = qr/^$/; } elsif ($field->{field} eq FID_ITEM_ID) { - $field->{pat} = qr/^bad-item$/; + $field->{pat} = qr/^bad-item$/; } } @@ -145,11 +145,11 @@ $test->{msg} =~ s/AA$user_barcode/AAbad_barcode/; $test->{pat} = qr/^300N[NU]N$datepat/; foreach my $field (@{$test->{fields}}) { if ($field->{field} eq FID_DUE_DATE) { - $field->{pat} = qr/^$/; + $field->{pat} = qr/^$/; } elsif ($field->{field} eq FID_PATRON_ID) { - $field->{pat} = qr/^bad_barcode$/; + $field->{pat} = qr/^bad_barcode$/; } elsif ($field->{field} eq FID_TITLE_ID) { - $field->{pat} = qr/^($item_title\s*|)$/; + $field->{pat} = qr/^($item_title\s*|)$/; } } diff --git a/t/10renew_all.t b/t/10renew_all.t index 16903ae..ba4db14 100755 --- a/t/10renew_all.t +++ b/t/10renew_all.t @@ -26,7 +26,7 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $user_barcode $item_barcode $item_owner - $item2_barcode $item2_owner $instid); + $item2_barcode $item2_owner $instid); my $enable_template = { id => 'Renew All: prep: enable patron permissions', @@ -36,48 +36,48 @@ my $enable_template = { }; my @checkout_templates = ( - { id => "Renew All: prep: check out $item_barcode", - msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", - pat => qr/^121NNY$datepat/, - fields => [],}, - { id => "Renew All: prep: check out $item2_barcode", - msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item2_barcode|AC|", - pat => qr/^121NNY$datepat/, - fields => [],} - ); + { id => "Renew All: prep: check out $item_barcode", + msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", + pat => qr/^121NNY$datepat/, + fields => [],}, + { id => "Renew All: prep: check out $item2_barcode", + msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item2_barcode|AC|", + pat => qr/^121NNY$datepat/, + fields => [],} + ); my @checkin_templates = ( - { id => "Renew All: prep: check in $item_barcode", - msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|", - pat => qr/^101YNN$datepat/, - fields => [],}, - { id => "Renew All: prep: check in $item2_barcode", - msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item2_barcode|ACterminal password|", - pat => qr/^101YNN$datepat/, - fields => [],} - ); + { id => "Renew All: prep: check in $item_barcode", + msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|", + pat => qr/^101YNN$datepat/, + fields => [],}, + { id => "Renew All: prep: check in $item2_barcode", + msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item2_barcode|ACterminal password|", + pat => qr/^101YNN$datepat/, + fields => [],} + ); my $renew_all_test_template = { id => 'Renew All: valid patron with one item checked out, no patron password', msg => "6520060102 084236AO$instid|AA$user_barcode|", pat => qr/^66100010000$datepat/, fields => [ - $SIPtest::field_specs{(FID_INST_ID)}, - $SIPtest::field_specs{(FID_SCREEN_MSG)}, - $SIPtest::field_specs{(FID_PRINT_LINE)}, - { field => FID_RENEWED_ITEMS, - pat => qr/^$item_barcode$/, - required => 1, }, - ],}; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + { field => FID_RENEWED_ITEMS, + pat => qr/^$item_barcode$/, + required => 1, }, + ],}; my @tests = ( - $SIPtest::login_test, - $SIPtest::sc_status_test, -# $enable_template, - $checkout_templates[0], - $renew_all_test_template, - $checkin_templates[0], # check the book in, when done testing - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, +# $enable_template, + $checkout_templates[0], + $renew_all_test_template, + $checkin_templates[0], # check the book in, when done testing + ); my $test; @@ -88,7 +88,7 @@ my $test; # my $field = $test->{fields}[$i]; # # if ($field->{field} eq FID_RENEWED_ITEMS) { -# $field->{pat} = qr/^$item_barcode\|$item2_barcode$/; +# $field->{pat} = qr/^$item_barcode\|$item2_barcode$/; # } #} # @@ -102,10 +102,10 @@ $test->{pat} = qr/^66000000000$datepat/; $test->{just_warn} = 1; delete $test->{fields}; $test->{fields} = [ - $SIPtest::field_specs{(FID_INST_ID)}, - $SIPtest::field_specs{(FID_SCREEN_MSG)}, - $SIPtest::field_specs{(FID_PRINT_LINE)}, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + ]; push @tests, $checkout_templates[0], $test, $checkin_templates[0]; @@ -115,10 +115,10 @@ $test->{msg} =~ s/AA$user_barcode/AAbad_barcode/; $test->{pat} = qr/^66000000000$datepat/; delete $test->{fields}; $test->{fields} = [ - $SIPtest::field_specs{(FID_INST_ID)}, - $SIPtest::field_specs{(FID_SCREEN_MSG)}, - $SIPtest::field_specs{(FID_PRINT_LINE)}, - ]; + $SIPtest::field_specs{(FID_INST_ID)}, + $SIPtest::field_specs{(FID_SCREEN_MSG)}, + $SIPtest::field_specs{(FID_PRINT_LINE)}, + ]; push @tests, $test; SIPtest::run_sip_tests(@tests); diff --git a/t/11item_info.t b/t/11item_info.t index c0e646d..2a6f1ad 100755 --- a/t/11item_info.t +++ b/t/11item_info.t @@ -26,34 +26,34 @@ use Clone qw(clone); use Sip::Constants qw(:all); use SIPtest qw($datepat $textpat $instid $currency $user_barcode - $item_barcode $item_title $item_owner); + $item_barcode $item_title $item_owner); 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, }, - ], }; + $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($item_info_test_template), - ); + $SIPtest::login_test, + $SIPtest::sc_status_test, + clone($item_info_test_template), + ); SIPtest::run_sip_tests(@tests); diff --git a/t/12end_session.t b/t/12end_session.t index c80fd72..71448f0 100755 --- a/t/12end_session.t +++ b/t/12end_session.t @@ -5,9 +5,9 @@ use warnings; use SIPtest qw($instid $user_barcode $user_pin); my $end_session = { id => 'End Session', - msg => "3520060101 084237AO$instid|AA$user_barcode|AC|AD$user_pin|", - pat => qr/^36Y/, - fields => [], }; + msg => "3520060101 084237AO$instid|AA$user_barcode|AC|AD$user_pin|", + pat => qr/^36Y/, + fields => [], }; my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, $end_session ); diff --git a/t/13fee_paid.t b/t/13fee_paid.t index c99961a..0e0a010 100755 --- a/t/13fee_paid.t +++ b/t/13fee_paid.t @@ -7,14 +7,14 @@ use SIPtest qw($instid $user_barcode $user_with_fees_barcode); # fee type = unknown, payment type = cash my $fee_paid_against_fees = { id => 'Fee Paid against user with fees', - msg => "3720060101 0842370100USDBV10.00|A0$instid|AA$user_with_fees_barcode|", - pat => qr/^38Y/, - fields => [], }; + msg => "3720060101 0842370100USDBV10.00|A0$instid|AA$user_with_fees_barcode|", + pat => qr/^38Y/, + fields => [], }; my $fee_paid_but_no_fees = { id => 'Fee Paid against user without fees', - msg => "3720060101 0842370100USDBV10.00|A0$instid|AA$user_barcode|", - pat => qr/^38N/, - fields => [], }; + msg => "3720060101 0842370100USDBV10.00|A0$instid|AA$user_barcode|", + pat => qr/^38N/, + fields => [], }; my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, $fee_paid_against_fees, $fee_paid_but_no_fees ); diff --git a/t/SIPtest.pm b/t/SIPtest.pm index 9c395be..39ce41a 100644 --- a/t/SIPtest.pm +++ b/t/SIPtest.pm @@ -29,26 +29,26 @@ our @ISA = qw(Exporter); our $VERSION = 0.02; our @EXPORT_OK = qw(run_sip_tests no_tagged_fields - $datepat $textpat - $login_test $sc_status_test - %field_specs - - $instid $currency $server $username $password - $user_barcode $user_pin $user_fullname $user_homeaddr - $user_email $user_phone $user_birthday $user_ptype - $user_inet $user_homelib - $block_user_barcode $block_user_pin $block_user_fullname $block_user_homeaddr - $block_user_email $block_user_phone $block_user_birthday $block_user_ptype - $block_user_inet $block_user_homelib - $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 + $datepat $textpat + $login_test $sc_status_test + %field_specs + + $instid $currency $server $username $password + $user_barcode $user_pin $user_fullname $user_homeaddr + $user_email $user_phone $user_birthday $user_ptype + $user_inet $user_homelib + $block_user_barcode $block_user_pin $block_user_fullname $block_user_homeaddr + $block_user_email $block_user_phone $block_user_birthday $block_user_ptype + $block_user_inet $block_user_homelib + $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 $cancel_hold_user_barcode $user_with_fees_barcode - $item_barcode $item_title $item_owner - $item2_barcode $item2_title $item2_owner + $item_barcode $item_title $item_owner + $item2_barcode $item2_title $item2_owner $item_on_hold_barcode - $item_diacritic_barcode $item_diacritic_title - $item_diacritic_owner); + $item_diacritic_barcode $item_diacritic_title + $item_diacritic_owner); # The number of tests is set in run_sip_tests() below, based # on the size of the array of tests. @@ -205,28 +205,28 @@ our %field_specs = ( # cases here and reference them in the individual test files. our $login_test = { id => 'login', - msg => "9300CN$username|CO$password|CP$instid|", - pat => qr/^941/, - fields => [], }; + msg => "9300CN$username|CO$password|CP$instid|", + pat => qr/^941/, + fields => [], }; our $sc_status_test = { id => 'SC status', - msg => '9910302.00', - pat => qr/^98[YN]{6}\d{3}\d{3}$datepat(2\.00|1\.00)/, - fields => [ - $field_specs{(FID_SCREEN_MSG)}, - $field_specs{(FID_PRINT_LINE)}, - $field_specs{(FID_INST_ID)}, - { field => 'AM', - pat => $textpat, - required => 0, }, - { field => 'BX', - pat => qr/^[YN]{16}$/, - required => 1, }, - { field => 'AN', - pat => $textpat, - required => 0, }, - ], - }; + msg => '9910302.00', + pat => qr/^98[YN]{6}\d{3}\d{3}$datepat(2\.00|1\.00)/, + fields => [ + $field_specs{(FID_SCREEN_MSG)}, + $field_specs{(FID_PRINT_LINE)}, + $field_specs{(FID_INST_ID)}, + { field => 'AM', + pat => $textpat, + required => 0, }, + { field => 'BX', + pat => qr/^[YN]{16}$/, + required => 1, }, + { field => 'AN', + pat => $textpat, + required => 0, }, + ], + }; our $debug = 1; our $error_detect = 0; @@ -326,7 +326,7 @@ sub run_sip_tests { foreach my $test (@_) { # print STDERR "Test $seqno:" . Dumper($test); one_msg($sock, $test, $seqno++); - $seqno %= 10; # sequence number is one digit + $seqno %= 10; # sequence number is one digit } } -- 2.11.0