2 # renew_all: test Renew All Response
8 use Sip::Constants qw(:all);
10 use SIPtest qw(:basic :user1 :item1 :item2);
12 my $enable_template = {
13 id => 'Renew All: prep: enable patron permissions',
14 msg => "2520060102 084238AO$instid|AA$user_barcode|",
15 pat => qr/^26 {4}[ Y]{10}000$datepat/,
19 my @checkout_templates = (
20 { id => "Renew All: prep: check out $item_barcode to $user_barcode",
21 msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item_barcode|AC$password|",
22 pat => qr/^121NNY$datepat/,
24 { id => "Renew All: prep: check out $item2_barcode to $user_barcode",
25 msg => "11YN20060329 203000 AO$instid|AA$user_barcode|AB$item2_barcode|AC$password|",
26 pat => qr/^121NNY$datepat/,
30 my @checkin_templates = (
31 { id => "Renew All: prep: check in $item_barcode",
32 msg => "09N20060102 08423620060113 084235AP$item_owner|AO$instid|AB$item_barcode|AC$password|",
33 pat => qr/^101YNN$datepat/,
35 { id => "Renew All: prep: check in $item2_barcode",
36 msg => "09N20060102 08423620060113 084235AP$item2_owner|AO$instid|AB$item2_barcode|AC$password|",
37 pat => qr/^101YNN$datepat/,
41 my $renew_all_test_template = {
42 id => "Renew All: patron ($user_barcode) with 1 item ($item_barcode) checked out, no patron password",
43 msg => "6520060102 084236AO$instid|AA$user_barcode|",
44 pat => qr/^66100010000$datepat/,
46 $SIPtest::field_specs{(FID_INST_ID)},
47 $SIPtest::field_specs{(FID_SCREEN_MSG)},
48 $SIPtest::field_specs{(FID_PRINT_LINE)},
49 { field => FID_RENEWED_ITEMS,
50 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];
71 if ($field->{field} eq FID_RENEWED_ITEMS) {
72 $field->{pat} = qr/^$item_barcode\|$item2_barcode$/;
76 #push @tests, @checkout_templates[0..1], $renew_all_test_template, @checkin_templates[0..1];
78 $test = clone($renew_all_test_template);
79 $test->{id} = 'Renew All: valid patron, invalid patron password';
80 $test->{msg} .= (FID_PATRON_PWD) . 'bad_pwd|';
81 $test->{pat} = qr/^66000000000$datepat/;
82 delete $test->{fields};
84 $SIPtest::field_specs{(FID_INST_ID)},
85 $SIPtest::field_specs{(FID_SCREEN_MSG)},
86 $SIPtest::field_specs{(FID_PRINT_LINE)},
89 push @tests, $checkout_templates[0], $test, $checkin_templates[0];
91 $test = clone($renew_all_test_template);
92 $test->{id} = 'Renew All: invalid patron';
93 $test->{msg} =~ s/AA$user_barcode/AAbad_barcode/;
94 $test->{pat} = qr/^66000000000$datepat/;
95 delete $test->{fields};
97 $SIPtest::field_specs{(FID_INST_ID)},
98 $SIPtest::field_specs{(FID_SCREEN_MSG)},
99 $SIPtest::field_specs{(FID_PRINT_LINE)},
103 SIPtest::run_sip_tests(@tests);