Bugzilla – Attachment 101972 Details for
Bug 21190
Add logging of successful/unsuccessful login attempts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21190: Add subtest to Log.t for GDPR logging
Bug-21190-Add-subtest-to-Logt-for-GDPR-logging.patch (text/plain), 3.78 KB, created by
Marcel de Rooy
on 2020-03-27 09:13:11 UTC
(
hide
)
Description:
Bug 21190: Add subtest to Log.t for GDPR logging
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-03-27 09:13:11 UTC
Size:
3.78 KB
patch
obsolete
>From 59ad7ab47411e8aebe3da5df6dc6f660162a7783 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 25 Oct 2019 07:32:56 +0000 >Subject: [PATCH] Bug 21190: Add subtest to Log.t for GDPR logging >Content-Type: text/plain; charset=utf-8 > >Apart from a new subtest, doing some more cleanup: >[1] Copyright statement >[2] Removing the (unneeded) flush >[3] Removing C4::Log from the BEGIN block; we seem to skip that nowadays. >[4] $succes goes to the subtest, $schema and $dbh are global our vars. > Not required but just what we should do if it would run under Plack. > >Test plan: >Run t/db_dependent/Log.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk> > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > t/db_dependent/Log.t | 52 +++++++++++++++++++++++++++++----------------------- > 1 file changed, 29 insertions(+), 23 deletions(-) > >diff --git a/t/db_dependent/Log.t b/t/db_dependent/Log.t >index d24a405afd..ca8fa9e454 100644 >--- a/t/db_dependent/Log.t >+++ b/t/db_dependent/Log.t >@@ -1,46 +1,39 @@ > #!/usr/bin/perl > # >-# Copyright 2011 MJ Ray and software.coop >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >+# This file is part of Koha. > # >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. > # >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-# This Koha test module is a stub! >-# Add more tests here!!! >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; > use Test::More tests => 5; > > use C4::Context; >+use C4::Log; > use Koha::Database; > use Koha::DateUtils; > > use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog >- >-$| = 1; >- >-BEGIN { >- use_ok('C4::Log'); >-} >-my $success; >+use t::lib::TestBuilder; > > # Make sure we can rollback. >-my $schema = Koha::Database->new->schema; >+our $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >-my $dbh = C4::Context->dbh; >+our $dbh = C4::Context->dbh; > > subtest 'Existing tests' => sub { > plan tests => 6; > >+ my $success; > eval { > # FIXME: are we sure there is an member number 1? > logaction("MEMBERS","MODIFY",1,"test operation"); >@@ -168,4 +161,17 @@ subtest 'GetLogs() respects interface filters' => sub { > is( @{$logs}[0]->{ interface }, 'commandline', 'Interface correctly filtered (commandline)'); > }; > >+subtest 'GDPR logging' => sub { >+ plan tests => 1; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ t::lib::Mocks::mock_userenv({ patron => $patron }); >+ logaction( 'AUTH', 'FAILURE', $patron->id, '', 'opac' ); >+ my $logs = GetLogs( undef, undef, $patron->id, ['AUTH'], ['FAILURE'], $patron->id ); >+ is( @$logs, 1, 'We should find one auth failure for this patron' ); >+ >+}; >+ > $schema->storage->txn_rollback; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21190
:
94713
|
94714
|
94715
|
94717
|
94732
|
94733
|
94734
|
94735
|
94736
|
94805
|
98067
|
98068
|
98069
|
98070
|
98071
|
98072
|
98073
|
98074
|
98110
|
98111
|
98112
|
98113
|
98114
|
98115
|
98116
|
98117
|
98125
|
98133
|
98134
|
98135
|
98136
|
98137
|
98138
|
98139
|
98140
|
98141
|
101971
|
101972
|
101973
|
101974
|
101975
|
101976
|
101977
|
101978
|
101979
|
102493
|
102494
|
102496
|
102497
|
102498
|
102499
|
102500
|
102501
|
102502
|
123540