2 # renew_all: test Renew All Response
8 use Sip::Constants qw(:all);
10 use SIPtest qw($datepat $textpat $user_barcode $item_barcode $item_owner
11 $item2_barcode $item2_owner $instid);
13 my $enable_template = {
14 id => 'Renew All: prep: enable patron permissions',
15 msg => "2520060102 084238AO$instid|AA$user_barcode|",
16 pat => qr/^26 {4}[ Y]{10}000$datepat/,
20 my @checkout_templates = (
21 { id => "Renew All: prep: check out $item_barcode",
22 msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC|",
23 pat => qr/^121NNY$datepat/,
25 { id => "Renew All: prep: check out $item2_barcode",
26 msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item2_barcode|AC|",
27 pat => qr/^121NNY$datepat/,
31 my @checkin_templates = (
32 { id => "Renew All: prep: check in $item_barcode",
33 msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item_barcode|ACterminal password|",
34 pat => qr/^101YNN$datepat/,
36 { id => "Renew All: prep: check in $item2_barcode",
37 msg => "09N20060102 08423620060113 084235APUnder the bed|AO$instid|AB$item2_barcode|ACterminal password|",
38 pat => qr/^101YNN$datepat/,
42 my $renew_all_test_template = {
43 id => 'Renew All: valid patron with one item checked out, no patron password',
44 msg => "6520060102 084236AO$instid|AA$user_barcode|",
45 pat => qr/^66100010000$datepat/,
47 $SIPtest::field_specs{(FID_INST_ID)},
48 $SIPtest::field_specs{(FID_SCREEN_MSG)},
49 $SIPtest::field_specs{(FID_PRINT_LINE)},
50 { field => FID_RENEWED_ITEMS,
51 pat => qr/^$item_barcode$/,
57 $SIPtest::sc_status_test,
59 $checkout_templates[0],
60 $renew_all_test_template,
61 $checkin_templates[0], # check the book in, when done testing
66 #$test = clone($renew_all_test_template);
67 #$test->{id} = 'Renew All: Valid patron, two items checked out';
68 #$test->{pat} = qr/^66100020000$datepat/;
69 #foreach my $i (0 .. (scalar @{$test->{fields}})-1) {
70 # my $field = $test->{fields}[$i];
72 # if ($field->{field} eq FID_RENEWED_ITEMS) {
73 # $field->{pat} = qr/^$item_barcode\|$item2_barcode$/;
77 #push @tests, $checkout_templates[0], $checkout_templates[1],
78 # $renew_all_test_template, $checkin_templates[0], $checkin_templates[1];
80 $test = clone($renew_all_test_template);
81 $test->{id} = 'Renew All: valid patron, invalid patron password';
82 $test->{msg} .= (FID_PATRON_PWD) . 'badpwd|';
83 $test->{pat} = qr/^66000000000$datepat/;
84 delete $test->{fields};
86 $SIPtest::field_specs{(FID_INST_ID)},
87 $SIPtest::field_specs{(FID_SCREEN_MSG)},
88 $SIPtest::field_specs{(FID_PRINT_LINE)},
91 push @tests, $checkout_templates[0], $test, $checkin_templates[0];
93 $test = clone($renew_all_test_template);
94 $test->{id} = 'Renew All: invalid patron';
95 $test->{msg} =~ s/AA$user_barcode/AAberick/;
96 $test->{pat} = qr/^66000000000$datepat/;
97 delete $test->{fields};
99 $SIPtest::field_specs{(FID_INST_ID)},
100 $SIPtest::field_specs{(FID_SCREEN_MSG)},
101 $SIPtest::field_specs{(FID_PRINT_LINE)},
105 SIPtest::run_sip_tests(@tests);