This tries to correct some broken tests and make use of the Concerto dataset.
One goal is to have these be applicable to both SIPServer and SIP2Mediator.
Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
{ field => FID_PATRON_ID,
- pat => qr/^berick$/,
+ pat => qr/^bad_barcode$/,
required => 1, },
{ field => FID_ITEM_ID,
pat => qr/^$item_barcode$/o,
use Sip::Constants qw(:all);
-use SIPtest qw($datepat $textpat $instid $user_barcode $password);
+use SIPtest qw($datepat $instid $currency $user_barcode $user_pin
+ $user_fullname $user_homeaddr $user_email $user_phone
+ $textpat $password
+ $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}001$datepat/,
+ pat => qr/^24 [ Y]{13}00[01]$datepat/,
fields => [
$SIPtest::field_specs{(FID_INST_ID)},
$SIPtest::field_specs{(FID_SCREEN_MSG)},
pat => qr/^$user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^David J\. Fiander$/,
+ pat => qr/^$user_fullname$/o,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
$test->{id} = 'Patron Status: invalid id';
$test->{msg} =~ s/AA$user_barcode\|/AAbad_userid|/ or warn "Substitution failed on test clone";
-# 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/;
+$test->{pat} = qr/^24Y[ Y]{13}00[01]$datepat/;
delete $test->{fields};
$test->{fields} = [
$test = clone($patron_status_test_template);
$test->{id} = 'Patron Status: Valid patron, invalid patron password';
$test->{msg} .= (FID_PATRON_PWD) . 'badpwd|';
-$test->{pat} = qr/^24[ Y]{14}001$datepat/;
+$test->{pat} = qr/^24[ Y]{14}00[01]$datepat/;
delete $test->{fields};
$test->{fields} = [
$SIPtest::field_specs{(FID_INST_ID)},
pat => qr/^$user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^David J\. Fiander$/,
+ pat => qr/^$user_fullname$/o,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
use Sip::Constants qw(:all);
-use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname);
+use SIPtest qw($datepat $textpat $instid $block_user_barcode $block_user_fullname);
my $block_patron_test_template = {
id => 'Block Patron: valid patron, card not retained',
- msg => "01N20060102 084238AO$instid|ALHe's a jerk|AA$user_barcode|ACterminal password|",
+ msg => "01N20060102 084238AO$instid|ALHe's a jerk|AA$block_user_barcode|ACterminal password|",
# response to block patron is a patron status message
pat => qr/^24Y[ Y]{13}000$datepat/o,
fields => [
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
{ field => FID_PATRON_ID,
- pat => qr/^$user_barcode$/o,
+ pat => qr/^$block_user_barcode$/o,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^$user_fullname$/o,
+ pat => qr/^$block_user_fullname$/o,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
use Sip::Constants qw(:all);
-use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname);
+use SIPtest qw($datepat $textpat $instid $block_user_barcode $block_user_fullname);
my $patron_enable_test_template = {
id => 'Patron Enable: valid patron',
- msg => "2520060102 084238AO$instid|AA$user_barcode|",
+ 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/^$user_barcode$/,
+ pat => qr/^$block_user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^$user_fullname$/,
+ pat => qr/^$block_user_fullname$/,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
# ensure that he was properly enabled.
my $patron_disable_test_template = {
id => 'Patron Enable: block patron (prep to test enabling)',
- msg => "01N20060102 084238AO$instid|ALHe's a jerk|AA$user_barcode|",
+ msg => "01N20060102 084238AO$instid|ALHe's a jerk|AA$block_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$/,
+ pat => qr/^$block_user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^$user_fullname$/,
+ pat => qr/^$block_user_fullname$/,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
{ field => FID_PATRON_ID,
- pat => qr/^$user_barcode$/,
+ pat => qr/^$block_user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^$user_fullname$/,
+ pat => qr/^$block_user_fullname$/,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
{ field => FID_PATRON_ID,
- pat => qr/^$user_barcode$/,
+ pat => qr/^$block_user_barcode$/,
required => 1, },
{ field => FID_PERSONAL_NAME,
- pat => qr/^$user_fullname$/,
+ pat => qr/^$block_user_fullname$/,
required => 1, },
{ field => FID_VALID_PATRON,
pat => qr/^Y$/,
# Invalid patron
$test = clone($patron_enable_test_template);
$test->{id} =~ s/valid/invalid/;
-$test->{msg} =~ s/AA$user_barcode\|/AAbad_userid|/;
+$test->{msg} =~ s/AA$block_user_barcode\|/AAbad_userid|/;
$test->{pat} = qr/^26Y{4}[ Y]{10}000$datepat/;
delete $test->{fields};
$test->{fields} = [
use Sip::Constants qw(:all);
-use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname $item_barcode $item_title $item_owner);
+use SIPtest qw($datepat $textpat $instid $user_barcode $user_fullname $item_barcode $item_title $item_owner $second_user_barcode $second_user_fullname $item_on_hold_barcode);
-warn "Holds not implemented (for Evergreen)";
-SIPtest::run_sip_tests();
-exit;
+#warn "Holds not implemented (for Evergreen)";
+#SIPtest::run_sip_tests();
+#exit;
my $hold_test_template = {
id => 'Place Hold: valid item, valid patron',
- msg => "15+20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$user_barcode|AB$item_barcode|",
+ 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)},
pat => qr/^1$/,
required => 1, },
{ field => FID_PICKUP_LOCN,
- pat => qr/^Taylor$/,
+ pat => qr/^BR1$/,
required => 1, },
{ field => FID_TITLE_ID,
pat => qr/^$item_title$/,
# Hold Queue: second hold placed on item
$test = clone($hold_test_template);
$test->{id} = 'Place hold: second hold on item';
-$test->{msg} =~ s/$user_barcode/miker/;
+$test->{msg} =~ s/$user_barcode/$second_user_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/^miker$/;
+ $field->{pat} = qr/^$second_user_barcode$/;
} elsif ($field->{field} eq FID_QUEUE_POS) {
$field->{pat} = qr/^2$/;
}
push @tests, $test, $hold_count_test_template0;
-# Cleanup: cancel miker's hold too.
+# Cleanup: cancel $second_user_barcode's hold too.
$test = clone($hold_test_template);
$test->{id} = "Cancel hold: cleanup second patron's hold";
$test->{msg} =~ s/\+/-/;
-$test->{msg} =~ s/$user_barcode/miker/;
+$test->{msg} =~ s/$user_barcode/$second_user_barcode/;
$test->{pat} = qr/^161[NY]$datepat/;
delete $test->{fields};
$test->{fields} = [
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
{ field => FID_PATRON_ID,
- pat => qr/^miker$/,
+ pat => qr/^$second_user_barcode$/,
+ required => 1, },
+ ];
+
+push @tests, $test;
+
+# Cleanup: cancel $second_user_barcode's concerto hold too.
+$test = clone($hold_test_template);
+$test->{id} = "Cancel hold: cleanup second patron's concerto hold";
+$test->{msg} =~ s/\+/-/;
+$test->{msg} =~ s/$user_barcode/$second_user_barcode/;
+$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, },
];
#my $hold_template = {
# id => 'Renew: prep: place hold on item',
-# msg =>"15+20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AAmiker|AB$item_barcode|",
+# 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|AAmiker|AB$item_barcode|",
+# msg =>"15-20060415 110158BW20060815 110158|BSTaylor|BY2|AO$instid|AA$second_user_barcode|AB$item_barcode|",
# pat => qr/^161[NY]$datepat/,
# fields => [],
# };
pat => qr/^$item_title\s*$/,
required => 1, },
{ field => FID_DUE_DATE,
- pat => qr/^$datepat$/,
+ pat => qr/^.+$/, # spec says ACS can return dates in any format it wants
required => 1, },
{ field => FID_SECURITY_INHIBIT,
pat => qr/^[YN]$/,
$test = clone($renew_test_template);
$test->{id} = 'Renew: Invalid user';
-$test->{msg} =~ s/AA$user_barcode/AAberick/;
+$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/^berick$/;
+ $field->{pat} = qr/^bad_barcode$/;
} elsif ($field->{field} eq FID_TITLE_ID) {
$field->{pat} = qr/^($item_title\s*|)$/;
}
$test = clone($renew_all_test_template);
$test->{id} = 'Renew All: invalid patron';
-$test->{msg} =~ s/AA$user_barcode/AAberick/;
+$test->{msg} =~ s/AA$user_barcode/AAbad_barcode/;
$test->{pat} = qr/^66000000000$datepat/;
delete $test->{fields};
$test->{fields} = [
my $item_info_test_template = {
id => 'Item Information: check information for available item',
msg => "1720060110 215612AO$instid|AB$item_barcode|",
- pat => qr/^180[13]0201$datepat/, # status of 'other' or 'available'
+ pat => qr/^180[139]0201$datepat/, # status of 'other' or 'available'
fields => [
$SIPtest::field_specs{(FID_SCREEN_MSG)},
$SIPtest::field_specs{(FID_PRINT_LINE)},
--- /dev/null
+#!/usr/bin/perl
+use strict;
+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 => [], };
+
+my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, $end_session );
+
+SIPtest::run_sip_tests(@tests);
+
+1;
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+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 => [], };
+
+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 => [], };
+
+my @tests = ( $SIPtest::login_test, $SIPtest::sc_status_test, $fee_paid_against_fees, $fee_paid_but_no_fees );
+
+SIPtest::run_sip_tests(@tests);
+
+1;
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use SIPtest qw($instid $user_barcode $user_pin);
+
+my $acs_resend_as_first_message = { id => 'ACS Resend Before Anything Else',
+ msg => "97",
+ pat => qr/^96/, # Request SC Resend
+ fields => [], };
+
+my @tests = ( $acs_resend_as_first_message );
+
+SIPtest::run_sip_tests(@tests);
+
+1;
+
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use SIPtest qw($instid $user_barcode $user_pin);
+
+my $acs_resend = { id => 'ACS Resend',
+ msg => "97",
+ pat => qr/^98/, # from the SC status test that will get invoked prior to this
+ fields => [], };
+
+my @tests = ( $SIPtest::sc_status_test, $acs_resend );
+
+SIPtest::run_sip_tests(@tests);
+
+1;
+
$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
+ $user_with_fees_barcode
$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);
#
# Configuration parameters to run the test suite
#
-our $instid = 'BR1';
+our $instid = 'example';
our $currency = 'USD';
our $server = 'localhost:6001'; # Address of the SIP server
# SIP username and password to connect to the server. See the
# SIP config.xml for the correct values.
-# our $username = 'scclient';
-# our $password = 'clientpwd';
-our $username = 'sip_01';
-our $password = 'sip_01';
+our $username = 'scclient';
+ our $password = 'clientpwd';
+#our $username = 'sip_01';
+#our $password = 'sip_01';
# ILS Information
# Valid user barcode and corresponding user password/pin and full name
-our $user_barcode = '999999'; # 'djfiander';
-our $user_pin = '6789';
-our $user_fullname = 'David J\. Fiander';
-our $user_homeaddr = '2 Meadowvale Dr\. St Thomas, ON Canada 90210';
-our $user_email = 'djfiander\@hotmail\.com';
-our $user_phone = '\(519\) 555 1234';
+our $user_barcode = '99999376864'; # 'djfiander';
+our $user_pin = 'leona1234';
+our $user_fullname = 'Leon Anderson';
+#our $user_homeaddr = '2 Meadowvale Dr\. St Thomas, ON Canada 90210';
+our $user_homeaddr = '9834 Standard Stravenue Providence, NC USA 27315';
+our $user_email = 'test\@evergreen-ils\.org';
+our $user_phone = '555-5555';
our $user_birthday = '19640925';
our $user_ptype = 'Patrons';
our $user_inet = 'Unfiltered';
our $user_homelib = 'BR1';
+# Valid user barcode and corresponding user password/pin and full name
+our $second_user_barcode = '99999397121';
+our $second_user_pin = 'carolynm1234';
+our $second_user_fullname = 'Carolyn Sandra Martinez';
+our $second_user_homeaddr = '7081 Appalling Plant Causeway Leland, MI USA 49654';
+our $second_user_email = 'test\@evergreen-ils\.org';
+our $second_user_phone = '555-5555';
+our $second_user_birthday = '19640925';
+our $second_user_ptype = 'Catalogers';
+our $second_user_inet = 'Unfiltered';
+our $second_user_homelib = 'BM1';
+# and an item they have a copy level hold for
+our $item_on_hold_barcode = 'CONC70000345';
+
+# Valid user (that we will deactivate later) barcode and corresponding user password/pin and full name
+our $block_user_barcode = '99999391951';
+our $block_user_pin = 'mistyg1234';
+our $block_user_fullname = 'Misty Margaret Gillespie';
+our $block_user_homeaddr = '4151 Severe Look Fort Scipio, IN USA 47273';
+our $block_user_email = 'test\@evergreen-ils\.org';
+our $block_user_phone = '555-5555';
+our $block_user_birthday = '19640925';
+our $block_user_ptype = 'Patrons';
+our $block_user_inet = 'Unfiltered';
+our $block_user_homelib = 'BR4';
+
+# Valid user barcode that has fees
+our $user_with_fees_barcode = '99999355250';
+
# Valid item barcode and corresponding title
# isbn: 9781565921870, 1565921879
# OCoLC: 34373965
-our $item_barcode = '1565921879';
-our $item_title = 'Perl 5 desktop reference';
+our $item_barcode = 'CONC4400038';
+our $item_title = 'Mozart and his piano concertos';
our $item_owner = 'BR1';
# Another valid item
# isbn: 9780553088533
# OCoLC: 25026617
-our $item2_barcode = '0440242746';
+our $item2_barcode = 'RDA400001660';
our $item2_title = 'Snow crash';
our $item2_owner = 'BR1';
# An item with a diacritical in the title
# isbn: 9788478886456, 9788478886456;
# OCoLC: 48667449
-our $item_diacritic_barcode = '660';
-our $item_diacritic_title = decode_utf8('Harry Potter y el cáliz de fuego');
+our $item_diacritic_barcode = 'CONC40000546';
+our $item_diacritic_title = decode_utf8('Composition student recital, April 6, 2000, Huntington University / composition students of Daniel Bédard');
our $item_diacritic_owner = 'BR1';
# End configuration
--- /dev/null
+update
+ actor.usr
+set
+ email = 'test@evergreen-ils.org'
+ ,day_phone = '555-5555'
+ ,dob = '1964-09-25'::date
+ ,net_access_level = 2
+where
+ id IN (71,72,232)
+;