2 # patron_status: test Patron Status Response
8 use Sip::Constants qw(:all);
9 use SIPtest qw(:user1 :basic);
11 my $patron_status_test_template = {
12 id => 'Patron Status: valid patron, no patron password',
13 msg => "2300120060101 084237AO$instid|AA$user_barcode|AC$password|",
14 pat => qr/^24[ Y]{14}001$datepat/,
16 $SIPtest::field_specs{(FID_INST_ID)},
17 $SIPtest::field_specs{(FID_SCREEN_MSG)},
18 $SIPtest::field_specs{(FID_PRINT_LINE)},
19 { field => FID_PATRON_ID,
20 pat => qr/^$user_barcode$/,
22 { field => FID_PERSONAL_NAME,
23 pat => qr/^$user_fullname$/,
25 { field => FID_VALID_PATRON,
27 # Not required by the spec, but by the test
29 $SIPtest::field_specs{(FID_CURRENCY)},
30 { field => FID_FEE_AMT,
37 $SIPtest::sc_status_test,
38 clone($patron_status_test_template),
42 my $test = clone($patron_status_test_template);
44 $test->{id} = 'Patron Status: invalid id';
45 $test->{msg} =~ s/AA$user_barcode\|/AAbad_userid|/;
47 # The test assumes that the language sent by the terminal is
48 # just echoed back for invalid patrons.
49 $test->{pat} = qr/^24Y[ Y]{13}001$datepat/;
51 delete $test->{fields};
53 $SIPtest::field_specs{(FID_INST_ID)},
54 $SIPtest::field_specs{(FID_SCREEN_MSG)},
55 $SIPtest::field_specs{(FID_PRINT_LINE)},
56 { field => FID_PATRON_ID,
57 pat => qr/^bad_userid$/,
59 { field => FID_PERSONAL_NAME,
62 { field => FID_VALID_PATRON,
69 # Valid patron, invalid patron password
70 $test = clone($patron_status_test_template);
71 $test->{id} = 'Patron Status: Valid patron, invalid patron password';
72 $test->{msg} .= (FID_PATRON_PWD) . 'badpwd|';
73 delete $test->{fields};
75 $SIPtest::field_specs{(FID_INST_ID)},
76 $SIPtest::field_specs{(FID_SCREEN_MSG)},
77 $SIPtest::field_specs{(FID_PRINT_LINE)},
78 { field => FID_PATRON_ID,
79 pat => qr/^$user_barcode$/,
81 { field => FID_PERSONAL_NAME,
82 pat => qr/^$user_fullname$/,
84 { field => FID_VALID_PATRON,
87 { field => FID_VALID_PATRON_PWD,
93 # TODO: Need multiple patrons to test each individual
96 SIPtest::run_sip_tests(@tests);