From 661606fd79bc1319e338ef2f54d95f4f7bb98cf1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 11 Feb 2019 13:16:10 -0500 Subject: [PATCH] Bug 21997: Unit tests --- t/db_dependent/SIP/Message.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t index 44fef285d5..f837fb4dd4 100755 --- a/t/db_dependent/SIP/Message.t +++ b/t/db_dependent/SIP/Message.t @@ -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; -- 2.17.2 (Apple Git-113)