Bugzilla – Attachment 163977 Details for
Bug 24879
Add missing authentication checks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24879: (follow-up) Fix test suite
Bug-24879-follow-up-Fix-test-suite.patch (text/plain), 3.92 KB, created by
Fridolin Somers
on 2024-03-27 09:25:22 UTC
(
hide
)
Description:
Bug 24879: (follow-up) Fix test suite
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2024-03-27 09:25:22 UTC
Size:
3.92 KB
patch
obsolete
>From f8a23b8ef46aea60eda9211a3e89af85d650ac26 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 27 Mar 2024 10:20:03 +0100 >Subject: [PATCH] Bug 24879: (follow-up) Fix test suite > >Running cataloguing pluings (in cataloguing/value_builder) now requires >authentification. > >This patch adds in failing unit tests a mock of C4::Auth::check_cookie_auth > >Test with: >prove t/db_dependent/FrameworkPlugin.t t/db_dependent/Koha/UI/Form/Builder/Biblio.t t/db_dependent/Koha/UI/Form/Builder/Item.t t/db_dependent/Serials.t >--- > t/db_dependent/FrameworkPlugin.t | 1 + > t/db_dependent/Koha/UI/Form/Builder/Biblio.t | 5 +++++ > t/db_dependent/Koha/UI/Form/Builder/Item.t | 5 +++++ > t/db_dependent/Serials.t | 5 +++++ > 4 files changed, 16 insertions(+) > >diff --git a/t/db_dependent/FrameworkPlugin.t b/t/db_dependent/FrameworkPlugin.t >index 71a8e3a1f3..679d69b953 100755 >--- a/t/db_dependent/FrameworkPlugin.t >+++ b/t/db_dependent/FrameworkPlugin.t >@@ -147,6 +147,7 @@ sub test05 { > my $mOutput = Test::MockModule->new('C4::Output'); > $mContext->mock( 'userenv', \&mock_userenv ); > $mAuth->mock( 'checkauth', sub { return ( 1, undef, 1, all_perms() ); } ); >+ $mAuth->mock( 'check_cookie_auth', sub { return ('ok') } ); > $mOutput->mock('output_html_with_http_headers', sub { ++$launched; } ); > > my $cgi=CGI->new; >diff --git a/t/db_dependent/Koha/UI/Form/Builder/Biblio.t b/t/db_dependent/Koha/UI/Form/Builder/Biblio.t >index cdf93c4880..ed5d582ef0 100755 >--- a/t/db_dependent/Koha/UI/Form/Builder/Biblio.t >+++ b/t/db_dependent/Koha/UI/Form/Builder/Biblio.t >@@ -18,6 +18,7 @@ > use Modern::Perl; > > use Test::More tests => 7; >+use Test::MockModule; > > use C4::ClassSource; > >@@ -26,6 +27,10 @@ use Koha::DateUtils qw( dt_from_string ); > use Koha::ItemTypes; > use Koha::Libraries; > >+# Auth required for cataloguing plugins >+my $mAuth = Test::MockModule->new('C4::Auth'); >+$mAuth->mock( 'check_cookie_auth', sub { return ('ok') } ); >+ > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >diff --git a/t/db_dependent/Koha/UI/Form/Builder/Item.t b/t/db_dependent/Koha/UI/Form/Builder/Item.t >index dedbb31775..de82c7741c 100755 >--- a/t/db_dependent/Koha/UI/Form/Builder/Item.t >+++ b/t/db_dependent/Koha/UI/Form/Builder/Item.t >@@ -17,6 +17,7 @@ > > use Modern::Perl; > use Test::More tests => 9; >+use Test::MockModule; > use Data::Dumper qw( Dumper ); > use utf8; > >@@ -28,6 +29,10 @@ use Koha::UI::Form::Builder::Item; > use t::lib::TestBuilder; > use t::lib::Mocks; > >+# Auth required for cataloguing plugins >+my $mAuth = Test::MockModule->new('C4::Auth'); >+$mAuth->mock( 'check_cookie_auth', sub { return ('ok') } ); >+ > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index 65c563d164..7a431c1edd 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -16,12 +16,17 @@ use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Acquisition::Booksellers; > use t::lib::Mocks; > use t::lib::TestBuilder; >+use Test::MockModule; > use Test::More tests => 54; > > BEGIN { > use_ok('C4::Serials', qw( updateClaim NewSubscription GetSubscription GetSubscriptionHistoryFromSubscriptionId SearchSubscriptions ModSubscription GetExpirationDate GetSerials GetSerialInformation NewIssue AddItem2Serial DelSubscription GetFullSubscription PrepareSerialsData GetSubscriptionsFromBiblionumber ModSubscriptionHistory GetSerials2 GetLatestSerials GetNextSeq GetSeq CountSubscriptionFromBiblionumber ModSerialStatus findSerialsByStatus HasSubscriptionStrictlyExpired HasSubscriptionExpired GetLateOrMissingIssues check_routing addroutingmember GetNextDate )); > } > >+# Auth required for cataloguing plugins >+my $mAuth = Test::MockModule->new('C4::Auth'); >+$mAuth->mock( 'check_cookie_auth', sub { return ('ok') } ); >+ > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > my $dbh = C4::Context->dbh; >-- >2.44.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 24879
:
100885
|
106978
|
163139
|
163140
|
163141
|
163142
|
163143
|
163183
|
163417
|
163418
|
163419
|
163420
|
163421
|
163422
| 163977