Bug 21997: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2019-02-11 13:16:10 -05:00 committed by root
parent 2d904a55e7
commit d0a6469ad5
1 changed files with 9 additions and 1 deletions

View File

@ -58,7 +58,7 @@ subtest 'Testing Patron Status Request V2' => sub {
subtest 'Testing Patron Info Request V2' => sub {
my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
plan tests => 18;
plan tests => 20;
$C4::SIP::Sip::protocol_version = 2;
test_request_patron_info_v2();
$schema->storage->txn_rollback;
@ -270,6 +270,14 @@ sub test_request_patron_info_v2 {
$respcode = substr( $response, 0, 2 );
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'Y', 'code CQ should be Y if empty AD allowed' );
t::lib::Mocks::mock_preference( 'FailedLoginAttempts', '1' );
my $patron = Koha::Patrons->find({ cardnumber => $card });
$patron->update({ login_attempts => 0 });
is( $patron->account_locked, 0, "Patron account not locked already" );
$msg->handle_patron_info( $server );
$patron = Koha::Patrons->find({ cardnumber => $card });
is( $patron->account_locked, 0, "Patron account is not locked by patron info messages with empty password" );
# Finally, we send a wrong card number
Koha::Patrons->search({ cardnumber => $card })->delete;
undef $findpatron;