Bugzilla – Attachment 154000 Details for
Bug 30524
Add base framework for dealing with CSRF in Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30524: (QA follow-up) Unit tests for GenerateCSRF()
Bug-30524-QA-follow-up-Unit-tests-for-GenerateCSRF.patch (text/plain), 2.08 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-07-27 18:41:48 UTC
(
hide
)
Description:
Bug 30524: (QA follow-up) Unit tests for GenerateCSRF()
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-07-27 18:41:48 UTC
Size:
2.08 KB
patch
obsolete
>From 60d11ae7251a227fab3977ecd61cb01d0f062f79 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 27 Jul 2023 15:33:55 -0300 >Subject: [PATCH] Bug 30524: (QA follow-up) Unit tests for GenerateCSRF() > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Template/Plugin/Koha.t | 49 ++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > create mode 100755 t/db_dependent/Koha/Template/Plugin/Koha.t > >diff --git a/t/db_dependent/Koha/Template/Plugin/Koha.t b/t/db_dependent/Koha/Template/Plugin/Koha.t >new file mode 100755 >index 00000000000..98318bdd534 >--- /dev/null >+++ b/t/db_dependent/Koha/Template/Plugin/Koha.t >@@ -0,0 +1,49 @@ >+#!/usr/bin/env perl >+ >+# This file is part of Koha. >+# >+# 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. >+# >+# 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 => 1; >+ >+use Template::Context; >+use Template::Stash; >+ >+use C4::Auth; >+use Koha::Database; >+use Koha::Template::Plugin::Koha; >+ >+my $schema = Koha::Database->new->schema; >+ >+subtest 'GenerateCSRF() tests' => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $session = C4::Auth::get_session(''); >+ >+ my $stash = Template::Stash->new( { sessionID => $session->id } ); >+ my $context = Template::Context->new( { STASH => $stash } ); >+ >+ my $plugin = Koha::Template::Plugin::Koha->new($context); >+ >+ my $token = $plugin->GenerateCSRF(); >+ >+ ok( Koha::Token->new->check_csrf( { session_id => $session->id, token => $token } ) ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.41.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 30524
:
133249
|
133250
|
133420
|
138055
|
141297
|
152629
|
152630
|
152631
|
152632
|
152634
|
152635
|
152637
|
152638
|
153964
|
153965
|
153975
|
153976
| 154000 |
154038