Bugzilla – Attachment 129727 Details for
Bug 29914
check_cookie_auth not strict enough
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29914: (QA follow-up) Expand tests to cover failure case before patches
Bug-29914-QA-follow-up-Expand-tests-to-cover-failu.patch (text/plain), 2.39 KB, created by
Nick Clemens
on 2022-01-24 14:36:38 UTC
(
hide
)
Description:
Bug 29914: (QA follow-up) Expand tests to cover failure case before patches
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2022-01-24 14:36:38 UTC
Size:
2.39 KB
patch
obsolete
>From e6f4c6880e9924860e9e831f1cdba4e618ae1f40 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 24 Jan 2022 14:19:24 +0000 >Subject: [PATCH] Bug 29914: (QA follow-up) Expand tests to cover failure case > before patches > >When asking for permissions we get 'failed', without we get 'ok' >Adding explicit checks for not 'ok' > >Add a FIXME: >We should cover the case where we return 'failed' after changes, but that is a larger undertaking > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Auth.t | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index 79bf960f43..c925f1b7ba 100755 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -442,7 +442,7 @@ subtest '_timeout_syspref' => sub { > }; > > subtest 'check_cookie_auth' => sub { >- plan tests => 1; >+ plan tests => 4; > > t::lib::Mocks::mock_preference('timeout', "1d"); # back to default > >@@ -464,8 +464,17 @@ subtest 'check_cookie_auth' => sub { > # Setting authnotrequired=1 or we wont' hit the return but the end of the sub that prints headers > my ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); > >- my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1}); >- is( $auth_status, 'anon', 'check_cookie_auth should not return ok if the user has not been authenticated before' ); >+ my ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID); >+ isnt( $auth_status, 'ok', 'check_cookie_auth should not return ok if the user has not been authenticated before if no permissions needed' ); >+ is( $auth_status, 'anon', 'check_cookie_auth should return anon if the user has not been authenticated before and no permissions needed' ); >+ >+ ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); >+ >+ ($auth_status, $session) = C4::Auth::check_cookie_auth($sessionID, {catalogue => 1}); >+ isnt( $auth_status, 'ok', 'check_cookie_auth should not return ok if the user has not been authenticated before and permissions needed' ); >+ is( $auth_status, 'anon', 'check_cookie_auth should return anon if the user has not been authenticated before and permissions needed' ); >+ >+ #FIXME We should have a test to cover 'failed' status when a user has logged in, but doesn't have permission > }; > > $schema->storage->txn_rollback; >-- >2.30.2
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 29914
:
129634
|
129643
|
129652
|
129664
|
129682
|
129693
|
129694
|
129718
|
129719
|
129720
|
129725
|
129726
| 129727 |
129728
|
129729
|
129742
|
129743