Bugzilla – Attachment 129752 Details for
Bug 29915
Anonymous session generates 1 new session ID per hit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29915: Add tests
Bug-29915-Add-tests.patch (text/plain), 2.34 KB, created by
Marcel de Rooy
on 2022-01-25 13:30:48 UTC
(
hide
)
Description:
Bug 29915: Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-01-25 13:30:48 UTC
Size:
2.34 KB
patch
obsolete
>From 6242fa8d3005be3df33264cce8e15423b90c8959 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Jan 2022 09:34:49 +0100 >Subject: [PATCH] Bug 29915: Add tests >Content-Type: text/plain; charset=utf-8 > >Rebased 25-01-22 on changes for 29914. >--- > t/db_dependent/Auth.t | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index f053bd115d..3e6a8b4774 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 => 4; >+ plan tests => 5; > > t::lib::Mocks::mock_preference('timeout', "1d"); # back to default > >@@ -458,20 +458,24 @@ subtest 'check_cookie_auth' => sub { > } > ); > $cgi->mock('multi_param', sub {return q{}} ); >- $cgi->mock( 'cookie', sub { return; } ); >+ my $sessionID; >+ $cgi->mock( 'cookie', sub { return $sessionID; } ); > $cgi->mock( 'request_method', sub { return 'POST' } ); > > $ENV{REMOTE_ADDR} = '127.0.0.1'; > > # 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 ( $userid, $cookie, $flags ); >+ ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); > > 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' ); > >+ my $original_sessionID = $sessionID; > ( $userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth( $cgi, 1 ); > >+ is( $original_sessionID, $sessionID, 'checkauth should not generate a different sessionID' ); > ($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' ); >-- >2.20.1
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 29915
:
129644
|
129653
|
129683
|
129748
|
129750
|
129751
|
129752
|
129753
|
129754
|
129755
|
129756
|
129822
|
129826
|
129827
|
129828
|
129829
|
129830
|
129831
|
129832
|
129833
|
129860
|
129861
|
129862
|
129863
|
129864
|
129865
|
129866
|
129878
|
129879
|
129880
|
129882
|
129883
|
129884
|
129885
|
129886
|
129887
|
129888
|
129889
|
129906
|
129907
|
129908
|
129909
|
129910
|
129911
|
129912
|
129913
|
129951
|
130596
|
130597
|
130598
|
130599
|
130600
|
130601
|
130602
|
130603
|
130604
|
131708
|
131709
|
131710
|
131711
|
131712
|
131713
|
131714
|
131715
|
131716
|
131788
|
131789
|
131790
|
131791
|
131792
|
131793
|
131794
|
131795
|
131796
|
131797
|
132101
|
132104
|
132114
|
132158
|
132159