2 # patron_status: test Patron Status Response
10 use C4
::SIP
::Sip
::Constants
qw(:all);
11 use SIPtest
qw(:user1 :basic);
13 my $patron_status_test_template = {
14 id
=> 'Patron Status: valid patron, no patron password',
15 msg
=> "2300120060101 084237AO$instid|AA$user_barcode|AC$password|",
16 pat
=> qr/^24[ Y]{14}001$datepat/,
18 $SIPtest::field_specs
{(FID_INST_ID
)},
19 $SIPtest::field_specs
{(FID_SCREEN_MSG
)},
20 $SIPtest::field_specs
{(FID_PRINT_LINE
)},
21 { field
=> FID_PATRON_ID
,
22 pat
=> qr/^$user_barcode$/,
24 { field
=> FID_PERSONAL_NAME
,
25 pat
=> qr/^$user_fullname$/,
27 { field
=> FID_VALID_PATRON
,
29 # Not required by the spec, but by the test
31 $SIPtest::field_specs
{(FID_CURRENCY
)},
32 { field
=> FID_FEE_AMT
,
39 $SIPtest::sc_status_test
,
40 clone
($patron_status_test_template),
44 my $test = clone
($patron_status_test_template);
46 $test->{id
} = 'Patron Status: invalid id';
47 $test->{msg
} =~ s/AA$user_barcode\|/AAbad_userid|/;
49 # The test assumes that the language sent by the terminal is
50 # just echoed back for invalid patrons.
51 $test->{pat
} = qr/^24Y[ Y]{13}001$datepat/;
53 delete $test->{fields
};
55 $SIPtest::field_specs
{(FID_INST_ID
)},
56 $SIPtest::field_specs
{(FID_SCREEN_MSG
)},
57 $SIPtest::field_specs
{(FID_PRINT_LINE
)},
58 { field
=> FID_PATRON_ID
,
59 pat
=> qr/^bad_userid$/,
61 { field
=> FID_PERSONAL_NAME
,
64 { field
=> FID_VALID_PATRON
,
71 # Valid patron, invalid patron password
72 $test = clone
($patron_status_test_template);
73 $test->{id
} = 'Patron Status: Valid patron, invalid patron password';
74 $test->{msg
} .= (FID_PATRON_PWD
) . 'badpwd|';
75 delete $test->{fields
};
77 $SIPtest::field_specs
{(FID_INST_ID
)},
78 $SIPtest::field_specs
{(FID_SCREEN_MSG
)},
79 $SIPtest::field_specs
{(FID_PRINT_LINE
)},
80 { field
=> FID_PATRON_ID
,
81 pat
=> qr/^$user_barcode$/,
83 { field
=> FID_PERSONAL_NAME
,
84 pat
=> qr/^$user_fullname$/,
86 { field
=> FID_VALID_PATRON
,
89 { field
=> FID_VALID_PATRON_PWD
,
95 # TODO: Need multiple patrons to test each individual
98 SIPtest
::run_sip_tests
(@tests);