Bug 21997: Unit tests
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 11 Feb 2019 18:16:10 +0000 (13:16 -0500)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 6 Mar 2019 16:13:48 +0000 (16:13 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit d0a6469ad58ccd6067bdfbb6cfb0e28dabc5862a)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a72d11e55dc24764faa6717d3d130ca92777afd0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

t/db_dependent/SIP/Message.t

index 44fef28..f837fb4 100755 (executable)
@@ -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;