Bugzilla – Attachment 151965 Details for
Bug 26700
Remove unused C4/SIP/t directory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26700: Remove unused C4/SIP/t directory
Bug-26700-Remove-unused-C4SIPt-directory.patch (text/plain), 59.60 KB, created by
Jonathan Druart
on 2023-06-02 05:24:51 UTC
(
hide
)
Description:
Bug 26700: Remove unused C4/SIP/t directory
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-06-02 05:24:51 UTC
Size:
59.60 KB
patch
obsolete
>From dc07b851fa6165f58af44992dd8f82fa2836527b Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 2 Jun 2023 02:18:45 +0000 >Subject: [PATCH] Bug 26700: Remove unused C4/SIP/t directory > >This patch removes the unused C4/SIP/t directory. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/SIP/t/000_sc_config_auth.t | 48 ------ > C4/SIP/t/00sc_status.t | 28 ---- > C4/SIP/t/01patron_status.t | 80 ---------- > C4/SIP/t/02patron_info.t | 169 -------------------- > C4/SIP/t/03checkout.t | 215 -------------------------- > C4/SIP/t/04patron_status.t | 100 ------------ > C4/SIP/t/05block_patron.t | 47 ------ > C4/SIP/t/06patron_enable.t | 146 ------------------ > C4/SIP/t/07hold.t | 191 ----------------------- > C4/SIP/t/08checkin.t | 86 ----------- > C4/SIP/t/09renew.t | 155 ------------------- > C4/SIP/t/10renew_all.t | 132 ---------------- > C4/SIP/t/11item_info.t | 43 ------ > C4/SIP/t/Makefile | 17 -- > C4/SIP/t/README | 50 ------ > C4/SIP/t/SIPtest.pm | 281 ---------------------------------- > 16 files changed, 1788 deletions(-) > delete mode 100755 C4/SIP/t/000_sc_config_auth.t > delete mode 100755 C4/SIP/t/00sc_status.t > delete mode 100755 C4/SIP/t/01patron_status.t > delete mode 100755 C4/SIP/t/02patron_info.t > delete mode 100755 C4/SIP/t/03checkout.t > delete mode 100755 C4/SIP/t/04patron_status.t > delete mode 100755 C4/SIP/t/05block_patron.t > delete mode 100755 C4/SIP/t/06patron_enable.t > delete mode 100755 C4/SIP/t/07hold.t > delete mode 100755 C4/SIP/t/08checkin.t > delete mode 100755 C4/SIP/t/09renew.t > delete mode 100755 C4/SIP/t/10renew_all.t > delete mode 100755 C4/SIP/t/11item_info.t > delete mode 100644 C4/SIP/t/Makefile > delete mode 100644 C4/SIP/t/README > delete mode 100644 C4/SIP/t/SIPtest.pm > >diff --git a/C4/SIP/t/000_sc_config_auth.t b/C4/SIP/t/000_sc_config_auth.t >deleted file mode 100755 >index 749a676de8e..00000000000 >--- a/C4/SIP/t/000_sc_config_auth.t >+++ /dev/null >@@ -1,48 +0,0 @@ >-#!/usr/bin/perl >-# >-# check if SIP terminal can Auth based on the xml config >-# >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >- >-use Test::More tests => 15; >- >-BEGIN { >- use_ok('C4::SIP::Sip::Constants', qw(:all)); >- use_ok('SIPtest', qw(:basic :user1 :auth)); >- use_ok('C4::Auth', qw(&check_api_auth)); >- use_ok('C4::Context'); >- use_ok('CGI'); >- use_ok('Data::Dumper'); >-} >- >-my ($status, $cookie, $sessionID, $uenv); >-my $query = CGI->new(); >-ok($username, sprintf "\$username exported by SIPtest (%s)", ($username||'')); >-ok($password, sprintf "\$password exported by SIPtest (%s)", ($password||'')); >- >-ok($ENV{REMOTE_USER} = $username, "set ENV{REMOTE_USER}"); # from SIPtest >-ok($query->param(userid => $username), "set \$query->param('userid')"); >-ok($query->param(password => $password), "set \$query->param('password')"); >- >-$status = api_auth(); >-$uenv = C4::Context->userenv; >-ok($status, sprintf "api_auth returned status (%s)", ($status ||'')); >-ok($uenv, "After api_auth, Got C4::Context->userenv :" . ($uenv ? Dumper($uenv) : '')); >- >-($status, $cookie, $sessionID) = check_api_auth($query, {circulate=>1}, "intranet"); >- >-ok($status, sprintf "checkauth returned status (%s)", ($status ||'')); >-# ok($cookie, sprintf "checkauth returned cookie (%s)", ($cookie ||'')); >-# ok($sessionID, sprintf "checkauth returned sessionID (%s)", ($sessionID||'')); >- >-diag "note: checkauth " . ($cookie ? "returned cookie ($cookie)\n" : "did NOT return cookie\n" ); >-diag "note: checkauth " . ($sessionID ? "returned sessionID ($sessionID)\n" : "did NOT return sessionID\n"); >- >-$uenv = C4::Context->userenv; >-ok($uenv, "After checkauth, Got C4::Context->userenv :" . ($uenv ? Dumper($uenv) : '')); >- >-diag "Done."; >diff --git a/C4/SIP/t/00sc_status.t b/C4/SIP/t/00sc_status.t >deleted file mode 100755 >index ce09a2b96bb..00000000000 >--- a/C4/SIP/t/00sc_status.t >+++ /dev/null >@@ -1,28 +0,0 @@ >-#!/usr/bin/perl >-# >-# sc_status: test basic connection, login, and response >-# to the SC Status message, which has to be sent before >-# anything else >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >- >-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 => [], }; >- >-my $invalid_pwd = { id => 'Invalid password', >- msg => "9300CN$username|COinvalid$password|CPThe floor|", >- pat => qr/^940/, >- fields => [], }; >- >-my @tests = ( $invalid_uname, $invalid_pwd, $login_test, $sc_status_test ); >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/01patron_status.t b/C4/SIP/t/01patron_status.t >deleted file mode 100755 >index 9ff35a2708d..00000000000 >--- a/C4/SIP/t/01patron_status.t >+++ /dev/null >@@ -1,80 +0,0 @@ >-#!/usr/bin/perl >-# >-# patron_status: check status of valid patron and invalid patron >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >- >-use C4::SIP::Sip::Constants qw(:all); >-use SIPtest qw($datepat $instid $currency :user1); >- >-my @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- { id => 'valid Patron Status', >- msg => "2300120060101 084237AO$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 => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^Y$/, >- required => 1, }, >- ], }, >- { 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); >- >-1; >diff --git a/C4/SIP/t/02patron_info.t b/C4/SIP/t/02patron_info.t >deleted file mode 100755 >index ff332129cd6..00000000000 >--- a/C4/SIP/t/02patron_info.t >+++ /dev/null >@@ -1,169 +0,0 @@ >-#!/usr/bin/perl >-# patron_info: test Patron Information Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1); >- >-# This is a template test case for the Patron Information >-# message handling. Because of the large number of fields, >-# this template forms the basis for all of the different >-# situations: valid patron no details, valid patron with each >-# individual detail requested, invalid patron, invalid patron >-# password, etc. >-our $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}/, >- 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, }, >- $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 => 1, }, # required by this test case >- { field => FID_EMAIL, >- pat => qr/^$user_email$/o, >- required => 1, }, >- { field => FID_HOME_PHONE, >- pat => qr/^$user_phone$/o, >- required => 1, }, >- { 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 => 1, }, >- ], }; >- >-our @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- clone($patron_info_test_template), >- ); >- >- >-# Create the test cases for the various summary detail fields >-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, }, >-# 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, }, >- ); >- >- foreach my $i (0 .. scalar @patron_info_summary_tests-1) { >- # The tests for each of the summary fields are exactly the >- # same as the basic one, except for the fact that there's >- # an extra field to test >- >- # Copy the hash, adjust it, add it to the end of the list >- $test = clone($patron_info_test_template); >- >- substr($test->{msg}, 23+$i, 1) = 'Y'; >- $test->{id} = "valid Patron Info details: " >- . $patron_info_summary_tests[$i]->{field}; >- push @{$test->{fields}}, $patron_info_summary_tests[$i]; >- push @tests, $test; >- } >-} >- >-sub create_invalid_patron_tests { >- my $test; >- >- $test = clone($patron_info_test_template); >- $test->{id} = "invalid Patron Info id"; >- $test->{msg} =~ s/AA$user_barcode\|/AAberick|/o; >- $test->{pat} = qr/^64Y[ Y]{13}\d{3}$datepat(\d{4}){6}/; >- 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/^berick$/, >- required => 1, }, >- { field => FID_PERSONAL_NAME, >- pat => qr/^$/, >- required => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^N$/, >- required => 1, }, >- ]; >- push @tests, $test; >- >- # Valid patron, invalid patron password >- $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}/; >- 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, >- pat => qr/^$user_fullname$/, >- required => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^Y$/, >- required => 1, }, >- { field => FID_VALID_PATRON_PWD, >- pat => qr/^N$/, >- required => 1, }, >- ]; >- push @tests, $test; >-} >- >-create_patron_summary_tests; >-create_invalid_patron_tests; >-SIPtest::run_sip_tests(@tests); >-1; >diff --git a/C4/SIP/t/03checkout.t b/C4/SIP/t/03checkout.t >deleted file mode 100755 >index c60bb0dbcc6..00000000000 >--- a/C4/SIP/t/03checkout.t >+++ /dev/null >@@ -1,215 +0,0 @@ >-#!/usr/bin/perl >-# checkout: test Checkout Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use CGI qw ( -utf8 ); >- >-use C4::SIP::Sip::Constants qw(:all); >-use SIPtest qw( >- :basic >- $user_barcode >- :diacritic >- :item1 >- ); >- >-my $patron_enable_template = { >- id => 'Renew All: prep: enable patron permissions', >- msg => "2520060102 084238AO$instid|AA$user_barcode|", >- pat => qr/^26 {4}[ Y]{10}000$datepat/o, >- fields => [], >-}; >- >-my $patron_disable_template = { >- id => 'Checkout: block patron (prep to test checkout denied)', >- msg => "01N20060102 084238AO$instid|ALFees overrun|AA$user_barcode|", >- # response to block patron is a patron status message >- pat => qr/^24Y{4}[ Y]{10}000$datepat/o, >- fields => [], >-}; >- >-my $checkin_template = { >- id => 'Checkout: cleanup: check in item', >- msg => "09N20050102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|ACterminal password|", >- pat => qr/^101YNN$datepat/o, >- fields => [], >-}; >- >-my $checkout_test_template = { >- id => 'Checkout: valid item, valid patron', >- 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, }, >- ], }; >- >-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 >- ); >- >-my $test; >- >-## Renewal OK >-## Test this by checking out exactly the same book a second time. >-## The only difference should be that the "Renewal OK" flag should now >-## be 'Y'. >-#$test = clone($checkout_test_template); >-#$test->{id} = 'Checkout: patron renewal'; >-#$test->{pat} = qr/^121YNY$datepat/; >- >-#push @tests, $test; >- >-# NOW check it in >- >-push @tests, $checkin_template; >- >-# Valid Patron, item with diacritical in the title >-#$test = clone($checkout_test_template); >-# >-#$test->{id} = 'Checkout: valid patron, diacritical character in title'; >-#$test->{msg} =~ s/AB$item_barcode/AB$item_diacritic_barcode/; >- >-#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$/; >-# } elsif ($field->{field} eq FID_TITLE_ID) { >-# $field->{pat} = qr/^$item_diacritic_title\s*$/; >-# } elsif ($field->{field} eq FID_OWNER) { >-# $field->{pat} = qr/^$item_diacritic_owner$/; >-# } >-#} >- >-#push @tests, $test; >- >-#$test = clone($checkin_template); >-#$test->{msg} =~ s/AB$item_barcode/AB$item_diacritic_barcode/; >-#push @tests, $test; >- >-# Valid Patron, Invalid Item_id >-$test = clone($checkout_test_template); >- >-$test->{id} = 'Checkout: valid patron, invalid item'; >-$test->{msg} =~ s/AB$item_barcode/ABno-barcode/o; >-$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$/o, >- required => 1, }, >- { field => FID_ITEM_ID, >- pat => qr/^no-barcode$/, >- required => 1, }, >- { field => FID_TITLE_ID, >- pat => qr/^$/, >- required => 1, }, >- { field => FID_DUE_DATE, >- pat => qr/^$/, >- required => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^Y$/, >- required => 1, }, >- ]; >- >-push @tests, $test; >- >-# Invalid patron, valid item >-$test = clone($checkout_test_template); >-$test->{id} = 'Checkout: invalid patron, valid item'; >-$test->{msg} =~ s/AA$user_barcode/AAberick/; >-$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/^berick$/, >- 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 => qr/^$/, >- required => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^N$/, >- required => 1, }, >- ]; >- >-push @tests, $test; >- >-# Needed: tests for blocked patrons, patrons with excessive >-# fines/fees, magnetic media, charging fees to borrow items. >- >-## Blocked patron >-#$test = clone($checkout_test_template); >-#$test->{id} = 'Checkout: Blocked patron'; >-#$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, }, >-# ]; >-# >-#push @tests, $patron_disable_template, $test, $patron_enable_template; >-# >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/04patron_status.t b/C4/SIP/t/04patron_status.t >deleted file mode 100755 >index 8c6ac49915a..00000000000 >--- a/C4/SIP/t/04patron_status.t >+++ /dev/null >@@ -1,100 +0,0 @@ >-#!/usr/bin/perl >-# patron_status: test Patron Status Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >-use SIPtest qw(:user1 :basic); >- >-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]{14}001$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, >- pat => qr/^$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_CURRENCY)}, >- { field => FID_FEE_AMT, >- pat => $textpat, >- required => 0, }, >- ], }; >- >-my @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- clone($patron_status_test_template), >- ); >- >-# Invalid patron >-my $test = clone($patron_status_test_template); >- >-$test->{id} = 'Patron Status: invalid id'; >-$test->{msg} =~ s/AA$user_barcode\|/AAbad_userid|/; >- >-# The test assumes that the language sent by the terminal is >-# just echoed back for invalid patrons. >-$test->{pat} = qr/^24Y[ Y]{13}001$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, }, >- ]; >- >-push @tests, $test; >- >-# Valid patron, invalid patron password >-$test = clone($patron_status_test_template); >-$test->{id} = 'Patron Status: Valid patron, invalid patron password'; >-$test->{msg} .= (FID_PATRON_PWD) . 'badpwd|'; >-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, >- pat => qr/^$user_fullname$/, >- required => 1, }, >- { field => FID_VALID_PATRON, >- pat => qr/^Y$/, >- required => 1, }, >- { field => FID_VALID_PATRON_PWD, >- pat => qr/^N$/, >- required => 1, }, >- ]; >-push @tests, $test; >- >-# TODO: Need multiple patrons to test each individual >-# status field >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/05block_patron.t b/C4/SIP/t/05block_patron.t >deleted file mode 100755 >index 474ae9de8e4..00000000000 >--- a/C4/SIP/t/05block_patron.t >+++ /dev/null >@@ -1,47 +0,0 @@ >-#!/usr/bin/perl >-# block_patron: test Block Patron Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1); >- >-my $block_patron_test_template = { >- id => 'Block Patron: valid patron, card not retained', >- msg => "01N20060102 084238AO$instid|ALThis card is blocked.|AA$user_barcode|AC$password|", >- # response to block patron is a patron status message >- pat => qr/^24Y[ Y]{13}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/^$user_barcode$/o, >- 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, }, >- ], }; >- >-my @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- clone($block_patron_test_template), >- ); >- >- SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/06patron_enable.t b/C4/SIP/t/06patron_enable.t >deleted file mode 100755 >index 8b95f6ef18b..00000000000 >--- a/C4/SIP/t/06patron_enable.t >+++ /dev/null >@@ -1,146 +0,0 @@ >-#!/usr/bin/perl >-# patron_enable: test Patron Enable Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1); >- >-my $patron_enable_test_template = { >- id => 'Patron Enable: valid patron', >- msg => "2520060102 084238AOUWOLS|AA$user_barcode|", >- pat => qr/^26 {4}[ Y]{10}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/^$user_barcode$/, >- required => 1, }, >- { field => FID_PERSONAL_NAME, >- pat => qr/^$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 they were properly enabled. >-my $patron_disable_test_template = { >- id => 'Patron Enable: block patron (prep to test enabling)', >- msg => "01N20060102 084238AO$instid|ALBlocked patron for SIP test.|AA$user_barcode|", >- # 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/^$user_barcode$/, >- required => 1, }, >- { field => FID_PERSONAL_NAME, >- pat => qr/^$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), >- ); >- >-my $test; >- >-# Valid patron, valid password >-$test = clone($patron_enable_test_template); >-$test->{id} = "Patron Enable: valid patron, valid password"; >-$test->{msg} .= FID_PATRON_PWD . "$user_pin|"; >-$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/^$user_barcode$/, >- required => 1, }, >- { field => FID_PERSONAL_NAME, >- pat => qr/^$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; >- >-# Valid patron, invalid password >-$test = clone($patron_enable_test_template); >-$test->{id} = "Patron Enable: valid patron, invalid password"; >-$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/^$user_barcode$/, >- required => 1, }, >- { field => FID_PERSONAL_NAME, >- pat => qr/^$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 >-push @tests, $patron_enable_test_template; >- >-# Invalid patron >-$test = clone($patron_enable_test_template); >-$test->{id} =~ s/valid/invalid/; >-$test->{msg} =~ s/AA$user_barcode\|/AAbad_barcode|/; >-$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_barcode$/, >- 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; >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/07hold.t b/C4/SIP/t/07hold.t >deleted file mode 100755 >index b05e3acb9ba..00000000000 >--- a/C4/SIP/t/07hold.t >+++ /dev/null >@@ -1,191 +0,0 @@ >-#!/usr/bin/perl >-# patron_enable: test Patron Enable Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1 :user2 :item1 :item2); >- >-my $hold_test_template = { >- id => "Place Hold: valid item ($item_barcode), valid patron ($user_barcode)", #BS could be another branch >- msg => "15+20060415 110158BW20060815 110158|BS$instid|BY2|AO$instid|AA$user_barcode|AB$item_barcode|", >- pat => qr/^161Y$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/^$item_owner$/, >- required => 0, }, >- { field => FID_TITLE_ID, >- pat => qr/^$item_title$/, >- required => 0, }, >- { field => FID_ITEM_ID, >- pat => qr/^$item_barcode$/, >- required => 0, }, >- ],}; >- >-my $tmp_msg = "6300020060329 201700 AO$instid|AA$user_barcode|"; >-my $hold_count_test_template0 = { >- id => "Confirm patron ($user_barcode) has 0 holds", >- msg => $tmp_msg, >- pat => qr/^64 [ Y]{13}\d{3}${datepat}0000(\d{4}){5}/, >- fields => [], >-}; >-my $hold_count_test_template1 = { >- id => "Confirm patron ($user_barcode) has 1 hold", >- msg => $tmp_msg, >- pat => qr/^64 [ Y]{13}\d{3}${datepat}((0001(\d{4}){4}0000)|(0000(\d{4}){4}0001))/, >- # The tricky part at the end here is because we don't know whether >- # the hold will count as "waiting" or unavailable. >- # But it will be one or the other! >- fields => [], >-}; >- >-my @tests = ( >- $SIPtest::login_test, # 1 >- $SIPtest::sc_status_test, # 2 >- $hold_test_template, $hold_count_test_template1, # 3,4 >- ); >- >-my $test; >- >-# Hold Queue: second hold placed on item >-$test = clone($hold_test_template); >-$test->{id} = "Place 2nd hold on item ($item_barcode) for user ($user2_barcode)"; >-$test->{msg} =~ s/AA$user_barcode\|/AA$user2_barcode|/; >-$test->{pat} = qr/^161N$datepat/; >-foreach my $i (0 .. (scalar @{$test->{fields}})-1) { >- my $field = $test->{fields}[$i]; >- if ($field->{field} eq FID_PATRON_ID) { >- $field->{pat} = qr/^$user2_barcode$/; >- } elsif ($field->{field} eq FID_QUEUE_POS) { >- $field->{pat} = qr/^2$/; >- } >-} >- >-push @tests, $test; # 5 >- >-# Cancel hold: valid hold >-$test = clone($hold_test_template); >-$test->{id} = "Cancel Hold: valid hold for user ($user_barcode)"; >-$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, }, >- ]; >- >-push @tests, $test, $hold_count_test_template0; # 6,7 >- >-# Cancel Hold: no hold on item >-# $test is already set up to cancel a hold, just change >-# the field tests >-$test = clone($test); >-$test->{id} = 'Cancel Hold: no hold on specified item'; >-$test->{pat} = qr/^160N$datepat/; >- >-push @tests, $test, $hold_count_test_template0; # 8,9 >- >-# Cleanup: cancel 2nd user's hold too. >-$test = clone($hold_test_template); >-$test->{id} = "Cancel hold: cleanup hold for 2nd patron ($user2_barcode)"; >-$test->{msg} =~ s/\+/-/; >-$test->{msg} =~ s/$user_barcode/$user2_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/^$user2_barcode$/, >- required => 1, }, >- ]; >- >-push @tests, $test; # 11 >- >-# Place hold: valid patron, item, invalid patron pwd >-$test = clone($hold_test_template); >-$test->{id} = 'Place hold: invalid patron password'; >-$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, }, >- ]; >- >-push @tests, $test, $hold_count_test_template0; # 12,13 >- >-# Place hold: invalid patron >-$test = clone($hold_test_template); >-$test->{id} = 'Place hold: invalid patron'; >-$test->{msg} =~ s/AA$user_barcode\|/AAbad_barcode|/; >-$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/^bad_barcode$/, >- required => 1, }, >- ]; >- >-# There's no patron to check the number of holds against >-push @tests, $test; # 14 >- >-# Place hold: invalid item >-$test = clone($hold_test_template); >-$test->{id} = 'Place hold: invalid item'; >-$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, }, >- ]; >- >-push @tests, $test, $hold_count_test_template0; # 15 >- >-# Still need tests for: >-# - valid patron not permitted to place holds >-# - valid item, not allowed to hold item >-# - multiple holds on item: correct queue position management >-# - setting and verifying hold expiry dates (requires ILS support) >-# - 3M checkin extensions for hold/ILL routing >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/08checkin.t b/C4/SIP/t/08checkin.t >deleted file mode 100755 >index d6165a2bb53..00000000000 >--- a/C4/SIP/t/08checkin.t >+++ /dev/null >@@ -1,86 +0,0 @@ >-#!/usr/bin/perl >-# checkin: test Checkin Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >-use SIPtest qw(:basic :user1 :item1); >- >-# Checkout response, format: >-# code: 12 >-# success: 0 or 1 >-# renewal ok: Y or N >-# magnetic media: Y, N or U >-# desensitize: Y or N >-# date >- >-# Checkin response, format: >-# code: 10 >-# success: 0 or 1 >-# resensitize: Y or N >-# magnetic media: Y, N or U >-# alert: Y or N >-# date >- >-my $checkout_template = { >- id => "Checkin: prep: check out item ($item_barcode)", >- msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", >- pat => qr/^121N[NYU][NY]$datepat/, >- fields => [], >-}; >- >-my $checkin_test_template = { >- id => "Checkin: Item ($item_barcode) is checked out", >- msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|", >- pat => qr/^101[NY][NYU]N$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_PERM_LOCN, >- pat => $textpat, >- required => 1, }, >- { field => FID_TITLE_ID, >- pat => qr/^$item_title\s*$/, >- required => 1, }, # not required by the spec. >- { field => FID_DESTINATION_LOCATION, >- pat => qr/^$item_owner\s*$/, >- required => 0, }, # 3M Extension >- ],}; >- >-my @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- $checkout_template, >- $checkin_test_template, >- ); >- >-my $test; >- >-# Checkin item that's not checked out. Basically, this >-# is identical to the first case, except the header says that >-# the ILS didn't check the item in, and there's no patron id. >-$test = clone($checkin_test_template); >-$test->{id} = 'Checkin: Item not checked out'; >-$test->{pat} = qr/^100[NY][NYU][NY]$datepat/o; >-$test->{fields} = [grep $_->{field} ne FID_PATRON_ID, @{$test->{fields}}]; >- >-push @tests, $test; >- >-# >-# Still need tests for magnetic media >-# >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/09renew.t b/C4/SIP/t/09renew.t >deleted file mode 100755 >index d00c71f74f9..00000000000 >--- a/C4/SIP/t/09renew.t >+++ /dev/null >@@ -1,155 +0,0 @@ >-#!/usr/bin/perl >-# renew: test Renew Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1 :item1); >- >-my $checkout_template = { >- id => "Renew: prep: check out item ($item_barcode) to patron ($user_barcode)", >- msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|", >- pat => qr/^121NNY$datepat/, >- fields => [], >-}; >- >-my $checkin_template = { >- id => "Renew: cleanup: check in item ($item_barcode)", >- msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$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|AAmiker|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|AAmiker|AB$item_barcode|", >-# pat => qr/^161[NY]$datepat/, >-# fields => [], >-# }; >-# >- >-my $renew_test_template = { >- id => "Renew: RENEW 1, item ($item_barcode) to patron ($user_barcode), renewal OK, no 3rd party, no fees", >- msg => "29NN20060102 084236 AO$instid|AA$user_barcode|AB$item_barcode|", >- pat => qr/^301Y[UN][UN]$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/^$datepat$/, >- 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::run_sip_tests(@tests); exit; # debug hack >- >-my $test; >- >-# Renew: item checked out, identify by title >-#$test = clone($renew_test_template); >-#$test->{id} = 'Renew: identify item by title'; >-#$test->{msg} =~ s/AB$item_barcode\|/AJ$item_title|/; >-## Everything else should be the same >-#push @tests, $test; >-# >-## Renew: Item checked out, but another patron has placed a hold >-#$test = clone($renew_test_template); >-#$test->{id} = 'Renew: Item has outstanding hold'; >-#$test->{pat} = qr/^300NUN$datepat/; >-#foreach my $field (@{$test->{fields}}) { >-# if ($field->{field} eq FID_DUE_DATE || $field->{field} eq FID_TITLE_ID) { >-# $field->{pat} = qr/^$/; >-# } >-#} >-# >-#push @tests, $hold_template, $test, $cancel_hold_template; >-# >-# >-# Tests for impossible renewals. >-# >-# Renew: item not checked out. Basically the same, except >-# for the leader test. >- >-$test = clone($renew_test_template); >-$test->{id} = 'Renew: item not checked out at all'; >-$test->{pat} = qr/^300NUN$datepat/; >-foreach my $field (@{$test->{fields}}) { >- if ($field->{field} eq FID_DUE_DATE) { >- $field->{pat} = qr/^$/; >- } elsif ($field->{field} eq FID_TITLE_ID) { >- $field->{pat} = qr/^($item_title\s*|)$/; >- } >-} >- >-push @tests, $checkin_template, $test; >- >-$test = clone($renew_test_template); >-$test->{id} = 'Renew: Invalid item (bad-item)'; >-$test->{msg} =~ s/AB[^|]+/ABbad-item/; >-$test->{pat} = qr/^300NUN$datepat/; >-foreach my $field (@{$test->{fields}}) { >- if ($field->{field} eq FID_TITLE_ID || $field->{field} eq FID_DUE_DATE) { >- $field->{pat} = qr/^$/; >- } elsif ($field->{field} eq FID_ITEM_ID) { >- $field->{pat} = qr/^bad-item$/; >- } >-} >- >-push @tests, $test; >- >-$test = clone($renew_test_template); >-$test->{id} = 'Renew: Invalid user (bad_barcode)'; >-$test->{msg} =~ s/AA$user_barcode/AAbad_barcode/; >-$test->{pat} = qr/^300NUN$datepat/; >-foreach my $field (@{$test->{fields}}) { >- if ($field->{field} eq FID_DUE_DATE) { >- $field->{pat} = qr/^$/; >- } elsif ($field->{field} eq FID_PATRON_ID) { >- $field->{pat} = qr/^bad_barcode$/; >- } elsif ($field->{field} eq FID_TITLE_ID) { >- $field->{pat} = qr/^($item_title\s*|)$/; >- } >-} >- >-push @tests, $test; >- >-# Still need tests for >-# - renewing a for-fee item >-# - patrons that are not permitted to renew >-# - renewing item that has reached limit on number of renewals >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/10renew_all.t b/C4/SIP/t/10renew_all.t >deleted file mode 100755 >index 29672930f32..00000000000 >--- a/C4/SIP/t/10renew_all.t >+++ /dev/null >@@ -1,132 +0,0 @@ >-#!/usr/bin/perl >-# renew_all: test Renew All Response >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >- >-use SIPtest qw(:basic :user1 :item1 :item2); >- >-my $enable_template = { >- id => 'Renew All: prep: enable patron permissions', >- msg => "2520060102 084238AO$instid|AA$user_barcode|", >- pat => qr/^26 {4}[ Y]{10}000$datepat/, >- fields => [], >-}; >- >-# reset_checkin_templates will be used to reset the status of the items if needed >-# If "make test" is used (all tests at once), after the tests 08 and 09, the item stays checked out and this raises an error here >-# so we begin with a Checkin, awaiting for the minimal answer : ^10 (Checkin response) >-# Both results (101 and 100, for OK and NON OK) must be accepted, because if we run this test alone, the item won't necessarily be checked out >-# and the checkin attempt will then result in a "100" code, which is not a problem (we are just preparing the renewal tests) >-my @reset_checkin_templates = ( >- { >- id => "Renew All: prep: check in $item_barcode (used in previous tests)", >- msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|", >- pat => qr/^10/, >- fields => [], >- }, >- { >- id => "Renew All: prep: check in $item2_barcode (used in previous tests)", >- msg => "09N20060102 08423620060113 084235AP$item2_owner|AO$instid|AB$item2_barcode|AC$password|", >- pat => qr/^10/, >- fields => [], >- } >-); >- >-# Checkout as a preparation for renewal >-my @checkout_templates = ( >- { id => "Renew All: prep: check out $item_barcode to $user_barcode", >- msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC$password|", >- pat => qr/^121NNY$datepat/, >- fields => [],}, >- { id => "Renew All: prep: check out $item2_barcode to $user_barcode", >- msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item2_barcode|AC$password|", >- pat => qr/^121NNY$datepat/, >- fields => [],} >-); >- >-my $renew_all_test_template = { >- id => "Renew All: patron ($user_barcode) with 1 item ($item_barcode) 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, }, >- ] >-}; >- >-# check the book in, when done testing >-my @checkin_templates = ( >- { >- id => "Renew All: prep: check in $item_barcode", >- msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|", >- pat => qr/^101YNN$datepat/, >- fields => [], >- }, >- { >- id => "Renew All: prep: check in $item2_barcode", >- msg => "09N20060102 08423620060113 084235AP$item2_owner|AO$instid|AB$item2_barcode|AC$password|", >- pat => qr/^101YNN$datepat/, >- fields => [], >- } >-); >- >- >- >-my @tests = ( >- $SIPtest::login_test, >- $SIPtest::sc_status_test, >- ); >- >-my $test; >- >-# WIP? >-$test = clone($renew_all_test_template); >-$test->{id} = 'Renew All: Valid patron, two items checked out'; >-$test->{pat} = qr/^66100020000$datepat/; >-foreach my $i (0 .. (scalar @{$test->{fields}})-1) { >- my $field = $test->{fields}[$i]; >- if ($field->{field} eq FID_RENEWED_ITEMS) { >- $field->{pat} = qr/^$item_barcode\|$item2_barcode$/; >- } >-} >- >-#push @tests, @checkout_templates[0..1], $renew_all_test_template, @checkin_templates[0..1]; >- >-$test = clone($renew_all_test_template); >-$test->{id} = 'Renew All: valid patron, invalid patron password'; >-$test->{msg} .= (FID_PATRON_PWD) . 'bad_pwd|'; >-$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)}, >- ]; >- >-push @tests, $reset_checkin_templates[0], $checkout_templates[0], $test, $checkin_templates[0]; >- >-$test = clone($renew_all_test_template); >-$test->{id} = 'Renew All: invalid patron'; >-$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)}, >- ]; >-push @tests, $test; >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/11item_info.t b/C4/SIP/t/11item_info.t >deleted file mode 100755 >index 0891cde7ed8..00000000000 >--- a/C4/SIP/t/11item_info.t >+++ /dev/null >@@ -1,43 +0,0 @@ >-#!/usr/bin/perl >-# Item Information test >- >-use strict; >-use warnings; >-use FindBin qw($Bin); >-use lib "$Bin"; >-use Clone qw(clone); >- >-use C4::SIP::Sip::Constants qw(:all); >-use SIPtest qw(:basic :user1 :item1); >- >-my $item_info_test_template = { >- id => "Item Information: check info for available item ($item_barcode)", >- msg => "1720060110 215612AO$instid|AB$item_barcode|", >- pat => qr/^180[13]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, >- $item_info_test_template, >-); >- >-SIPtest::run_sip_tests(@tests); >- >-1; >diff --git a/C4/SIP/t/Makefile b/C4/SIP/t/Makefile >deleted file mode 100644 >index 17920fd2796..00000000000 >--- a/C4/SIP/t/Makefile >+++ /dev/null >@@ -1,17 +0,0 @@ >-# >-# >-# >- >-TESTS = 000_sc_config_auth.t \ >- 00sc_status.t 01patron_status.t 02patron_info.t 03checkout.t \ >- 04patron_status.t 05block_patron.t 06patron_enable.t 07hold.t \ >- 08checkin.t 09renew.t 10renew_all.t 11item_info.t >- >-OILS_TESTS = 00sc_status.t 01patron_status.t 02patron_info.t 03checkout.t \ >- 08checkin.t 09renew.t 11item_info.t 05block_patron.t >- >-test-openils: >- prove -I.. $(OILS_TESTS) >- >-test: >- prove -I../ -I./ $(TESTS) >diff --git a/C4/SIP/t/README b/C4/SIP/t/README >deleted file mode 100644 >index 9f954f34ecc..00000000000 >--- a/C4/SIP/t/README >+++ /dev/null >@@ -1,50 +0,0 @@ >-CONFIGURING THE TEST SUITE >- >-Before you can run the test suite, you need to configure certain >-information about the SIP server and the ILS data in the file >-SIPtest.pm. >- >-RUNNING THE TESTS >- >-Every file tests a different protocol transaction. >-Unfortunately, a lot of test cases are missing, but the basics >-are tested, as are most of the simple error conditions (invalid >-users, unknown items, checking in item that's not checked out). >- >-To run a single test, just run >- >- perl -I.. <file> >- >-If the test fails, the output should be pretty clear about what >-went wrong (assuming you can read raw SIP packets). >- >-To run all the tests, just type >- >- make test >- >-Right now, that will run tests for functionality that isn't >-supported in the Evergreen environment (the two main cases are >-enable patron and hold management). To run just the Evergreen tests, use >- >- make test-openils >- >-which will run just the tests >- >- 00sc_status.t >- 01patron_status.t >- 02patron_info.t >- 03checkout.t >- 06patron_enable.t >- 08checkin.t >- 09renew.t >- 11item_info.t >- 05block_patron.t >- >-NOTE: the Block Patron tests are run last because "Patron Enable" >-isn't supported. Thus, after running the "Block Patron" test, >-manual intervention is required to unblock the test patron. >- >-The Renew All tests will fail when running the stub "ILS" >-implementation unless there's only one ILS server running. This >-won't be a problem for any real backend implementation that >-properly manages the database of users and items. >diff --git a/C4/SIP/t/SIPtest.pm b/C4/SIP/t/SIPtest.pm >deleted file mode 100644 >index 6d750a793af..00000000000 >--- a/C4/SIP/t/SIPtest.pm >+++ /dev/null >@@ -1,281 +0,0 @@ >-package SIPtest; >- >-use strict; >-use warnings; >- >-use Exporter; >-use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); >- >-use Data::Dumper; >- >-BEGIN { >- @ISA = qw(Exporter); >- %EXPORT_TAGS = ( >- auth => [qw(&api_auth)], >- basic => [qw($datepat $textpat $login_test $sc_status_test >- $instid $instid2 $currency $server $username $password)], >- # duplicate user1 and item1 as user2 and item2 >- # w/ tags like $user2_pin instead of $user_pin >- user1 => [qw($user_barcode $user_pin $user_fullname $user_homeaddr $user_email >- $user_phone $user_birthday $user_ptype $user_inet)], >- user2 => [qw($user2_barcode $user._pin $user2_fullname $user2_homeaddr $user2_email >- $user2_phone $user2_birthday $user2_ptype $user2_inet)], >- item1 => [qw($item_barcode $item_title $item_owner )], >- item2 => [qw($item2_barcode $item2_title $item2_owner )], >- # we've got item3_* also >- item3 => [qw($item3_barcode $item3_title $item3_owner )], >- diacritic => [qw($item_diacritic_barcode $item_diacritic_title $item_diacritic_owner)], >- ); >- # From perldoc Exporter >- # Add all the other ":class" tags to the ":all" class, deleting duplicates >- my %seen; >- push @{$EXPORT_TAGS{all}}, >- grep {!$seen{$_}++} @{$EXPORT_TAGS{$_}} foreach keys %EXPORT_TAGS; >- Exporter::export_ok_tags('all'); # Anything in a tag is in OK_EXPORT >- # print Dumper(\%EXPORT_TAGS); # Uncomment if you want to see the results of these tricks. >-} >- >-# The number of tests is set in run_sip_tests() below, based >-# on the size of the array of tests. >-use Test::More; >-use CGI qw ( -utf8 ); >- >-use IO::Socket::INET; >-use C4::SIP::Sip qw(:all); >-use C4::SIP::Sip::Checksum qw(verify_cksum); >-use C4::SIP::Sip::Constants qw(:all); >- >-use C4::Auth qw(&check_api_auth); >-use C4::Context; >- >-# TODO: just read SIPconfig.xml and extract what we can.... >-# >-# Configuration parameters to run the test suite >-# >-our $instid = 'CPL'; # branchcode >-our $instid2 = 'FPL'; # branchcode >-our $currency = 'USD'; # 'CAD'; >-our $server = 'localhost:6001'; # Address of the SIP server >- >-# SIP username and password to connect to the server. >-# See SIPconfig.xml for the correct values. >-our $username = 'term1'; >-our $password = 'term1'; >- >-# ILS Information >- >-# NOTE: make sure to escape the data for use in RegExp. >-# Valid user barcode and corresponding user password/pin and full name >-our $user_barcode = '23529001000463'; >-our $user_pin = 'fn5zS'; >-our $user_fullname= 'Edna Acosta'; >-our $user_homeaddr= '7896 Library Rd\.'; >-our $user_email = 'patron\@liblime\.com'; >-our $user_phone = '\(212\) 555-1212'; >-our $user_birthday= '19800424'; # YYYYMMDD, ANSI X3.30 >-our $user_ptype = 'PT'; >-our $user_inet = 'Y'; >- >-# Another valid user >-our $user2_barcode = '23529000240482'; >-our $user2_pin = 'jw937'; >-our $user2_fullname= 'Jamie White'; >-our $user2_homeaddr= '937 Library Rd\.'; >-our $user2_email = 'patron\@liblime\.com'; >-our $user2_phone = '\(212\) 555-1212'; >-our $user2_birthday= '19500422'; # YYYYMMDD, ANSI X3.30 >-our $user2_ptype = 'T'; >-our $user2_inet = 'Y'; >- >-# Valid item barcode and corresponding title >-our $item_barcode = '502326000005'; >-our $item_title = 'How I became a pirate /'; >-our $item_owner = 'CPL'; >- >-# Another valid item >-our $item2_barcode = '502326000011'; >-our $item2_title = 'The biggest, smallest, fastest, tallest things you\'ve ever heard of /'; >-our $item2_owner = 'CPL'; >- >-# A third valid item >-our $item3_barcode = '502326000240'; >-our $item3_title = 'The girl who owned a city /'; >-our $item3_owner = 'FPL'; >- >-# An item with a diacritical in the title >-our $item_diacritic_barcode = '502326001030'; >-our $item_diacritic_titlea = 'Hari Poṭer u-geviʻa ha-esh /'; >-our $item_diacritic_owner = 'CPL'; >- >-# End configuration >- >-# Pattern for a SIP datestamp, to be used by individual tests to >-# match timestamp fields (duh). >-our $datepat = '\d{8} {4}\d{6}'; >- >-# Pattern for a random text field (may be empty) >-our $textpat = qr/^[^|]*$/; >- >-our %field_specs = ( >- (FID_SCREEN_MSG) => { field => FID_SCREEN_MSG, >- pat => $textpat, >- required => 0, }, >- (FID_PRINT_LINE) => { field => FID_PRINT_LINE, >- pat => $textpat, >- required => 0, }, >- (FID_INST_ID) => { field => FID_INST_ID, >- pat => qr/^$instid$/o, >- required => 1, }, >- (FID_HOLD_ITEMS_LMT)=> { field => FID_HOLD_ITEMS_LMT, >- pat => qr/^\d{4}$/, >- required => 0, }, >- (FID_OVERDUE_ITEMS_LMT)=> { field => FID_OVERDUE_ITEMS_LMT, >- pat => qr/^\d{4}$/, >- required => 0, }, >- (FID_CHARGED_ITEMS_LMT)=> { field => FID_CHARGED_ITEMS_LMT, >- pat => qr/^\d{4}$/, >- required => 0, }, >- (FID_VALID_PATRON) => { field => FID_VALID_PATRON, >- pat => qr/^[NY]$/, >- required => 0, }, >- (FID_VALID_PATRON_PWD)=> { field => FID_VALID_PATRON_PWD, >- pat => qr/^[NY]$/, >- required => 0, }, >- (FID_CURRENCY) => { field => FID_CURRENCY, >- pat => qr/^$currency$/io, >- required => 0, }, >- ); >- >-# Login and SC Status are always the first two messages that >-# the terminal sends to the server, so just create the test >-# cases here and reference them in the individual test files. >- >-our $login_test = { id => 'login', >- msg => "9300CN$username|CO$password|CPThe floor|", >- 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, }, >- ], >- }; >- >-sub one_msg { >- my ($sock, $test, $seqno) = @_; >- my $resp; >- my %fields; >- >- # If reading or writing fails, then the server's dead, >- # so there's no point in continuing. >- if ( !write_msg( { seqno => $seqno }, $test->{msg}, $sock ) ) { >- BAIL_OUT("Write failure in $test->{id}"); >- } >- >- my $rv = sysread( $sock, $resp, 10000000 ); # 10000000 is a big number >- >- if ( !$rv ) { >- BAIL_OUT("Read failure in $test->{id}"); >- } >- >- chomp($resp); >- $resp =~ tr/\cM//d; >- $resp =~ s/\015?\012$//; >- chomp($resp); >- >- if (!verify_cksum($resp)) { >- fail("$test->{id} checksum($resp)"); >- return; >- } >- if ($resp !~ $test->{pat}) { >- fail("match leader $test->{id}"); >- diag("Response '$resp' doesn't match pattern '$test->{pat}'"); >- return; >- } >- >- # Split the tagged fields of the response into (name, value) >- # pairs and stuff them into the hash. >- $resp =~ $test->{pat}; >- %fields = substr($resp, $+[0]) =~ /(..)([^|]*)\|/go; >- >- # print STDERR "one_msg ( test ) : " . Dumper($test) . "\n" . >- # "one_msg (fields) : " . Dumper(\%fields); >- if (!defined($test->{fields})) { >- diag("TODO: $test->{id} field tests not written yet"); >- } else { >- # If there are no tagged fields, then 'fields' should be an >- # empty list which will automatically skip this loop >- foreach my $ftest (@{$test->{fields}}) { >- my $field = $ftest->{field}; >- >- if ($ftest->{required} && !exists($fields{$field})) { >- fail("$test->{id}: required field '$field' not found in '$resp'"); >- return; >- } >- >- if (exists($fields{$field}) && ($fields{$field} !~ $ftest->{pat})) { >- fail("$test->{id} field test $field"); >- diag("Field '$field' pattern '$ftest->{pat}' fails to match value '$fields{$field}' in message '$resp'"); >- return; >- } >- } >- } >- pass("$test->{id}"); >- return; >-} >- >-sub api_auth { >- # AUTH >- $ENV{REMOTE_USER} = $username; >- my $query = CGI->new(); >- $query->param(userid => $username); >- $query->param(password => $password); >- my ($status, $cookie, $sessionID) = check_api_auth($query, {circulate=>1}, "intranet"); >- print STDERR "check_api_auth returns " . ($status || 'undef') . "\n"; >- # print STDERR "api_auth userenv = " . &dump_userenv; >- return $status; >-} >- >-sub dump_userenv { >- my $userenv = C4::Context->userenv; >- return "# userenv: EMPTY\n" unless ($userenv); >- my $userbranch = $userenv->{branch}; >- return "# userenv: " . Dumper($userenv) >- . ($userbranch ? "BRANCH FOUND: $userbranch\n" : "NO BRANCH FOUND\n"); >-} >- >-sub run_sip_tests { >- my ($sock, $seqno); >- >- $Sip::error_detection = 1; >- $/ = "\015\012"; # must use correct record separator >- >- $sock = IO::Socket::INET->new(PeerAddr => $server, >- Type => SOCK_STREAM); >- >- BAIL_OUT('failed to create connection to server') unless $sock; >- >- $seqno = 1; >- # print STDERR "Number of tests : ", scalar (@_), "\n"; >- plan tests => scalar(@_); >- foreach my $test (@_) { >- # print STDERR "Test $seqno:" . Dumper($test); >- one_msg($sock, $test, $seqno++); >- $seqno %= 10; # sequence number is one digit >- } >-} >- >-1; >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26700
:
151960
|
151965
|
151966
|
152295
|
152296