|
Lines 58-64
subtest 'Testing Patron Status Request V2' => sub {
Link Here
|
| 58 |
subtest 'Testing Patron Info Request V2' => sub { |
58 |
subtest 'Testing Patron Info Request V2' => sub { |
| 59 |
my $schema = Koha::Database->new->schema; |
59 |
my $schema = Koha::Database->new->schema; |
| 60 |
$schema->storage->txn_begin; |
60 |
$schema->storage->txn_begin; |
| 61 |
plan tests => 18; |
61 |
plan tests => 20; |
| 62 |
$C4::SIP::Sip::protocol_version = 2; |
62 |
$C4::SIP::Sip::protocol_version = 2; |
| 63 |
test_request_patron_info_v2(); |
63 |
test_request_patron_info_v2(); |
| 64 |
$schema->storage->txn_rollback; |
64 |
$schema->storage->txn_rollback; |
|
Lines 263-268
sub test_request_patron_info_v2 {
Link Here
|
| 263 |
$respcode = substr( $response, 0, 2 ); |
263 |
$respcode = substr( $response, 0, 2 ); |
| 264 |
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'code CQ should be N for empty AD' ); |
264 |
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'code CQ should be N for empty AD' ); |
| 265 |
# Test empty password is OK if account configured to allow |
265 |
# Test empty password is OK if account configured to allow |
|
|
266 |
t::lib::Mocks::mock_preference( 'FailedLoginAttempts', '1' ); |
| 266 |
$server->{account}->{allow_empty_passwords} = 1; |
267 |
$server->{account}->{allow_empty_passwords} = 1; |
| 267 |
$msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); |
268 |
$msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); |
| 268 |
undef $response; |
269 |
undef $response; |
|
Lines 270-275
sub test_request_patron_info_v2 {
Link Here
|
| 270 |
$respcode = substr( $response, 0, 2 ); |
271 |
$respcode = substr( $response, 0, 2 ); |
| 271 |
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'Y', 'code CQ should be Y if empty AD allowed' ); |
272 |
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'Y', 'code CQ should be Y if empty AD allowed' ); |
| 272 |
|
273 |
|
|
|
274 |
t::lib::Mocks::mock_preference( 'FailedLoginAttempts', '1' ); |
| 275 |
my $patron = Koha::Patrons->find({ cardnumber => $card }); |
| 276 |
$patron->update({ login_attempts => 0 }); |
| 277 |
is( $patron->account_locked, 0, "Patron account not locked already" ); |
| 278 |
$msg->handle_patron_info( $server ); |
| 279 |
$patron = Koha::Patrons->find({ cardnumber => $card }); |
| 280 |
is( $patron->account_locked, 0, "Patron account is not locked by patron info messages with empty password" ); |
| 281 |
|
| 273 |
# Finally, we send a wrong card number |
282 |
# Finally, we send a wrong card number |
| 274 |
Koha::Patrons->search({ cardnumber => $card })->delete; |
283 |
Koha::Patrons->search({ cardnumber => $card })->delete; |
| 275 |
undef $findpatron; |
284 |
undef $findpatron; |
| 276 |
- |
|
|