Bugzilla – Attachment 138146 Details for
Bug 28787
Send a notice with the TOTP token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28787: Fix misleading tests in two_factor_auth.t
Bug-28787-Fix-misleading-tests-in-twofactorautht.patch (text/plain), 2.05 KB, created by
Jonathan Druart
on 2022-07-27 07:04:22 UTC
(
hide
)
Description:
Bug 28787: Fix misleading tests in two_factor_auth.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-07-27 07:04:22 UTC
Size:
2.05 KB
patch
obsolete
>From 0fee65423b076dd116e6d596ae15643a48da441b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 26 Jul 2022 11:43:36 +0200 >Subject: [PATCH] Bug 28787: Fix misleading tests in two_factor_auth.t > >We were having a "Patron is not authenticated yet" comment, but it was not correct, >we set 'number' and 'id' in session, and waiting-for-2FA was not set => the patron is fully authenticated. >The test returned 401 because we fully authenticated user cannot request >an otp token when not waiting for the second auth step. > >This situation is already covered (last test of the subtest). > >Test plan: > prove t/db_dependent/api/v1/two_factor_auth.t >must return green >--- > t/db_dependent/api/v1/two_factor_auth.t | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/two_factor_auth.t b/t/db_dependent/api/v1/two_factor_auth.t >index fc9796dba50..8278e8d5e08 100755 >--- a/t/db_dependent/api/v1/two_factor_auth.t >+++ b/t/db_dependent/api/v1/two_factor_auth.t >@@ -57,8 +57,6 @@ subtest 'send_otp_token' => sub { > ); > > my $session = C4::Auth::get_session(''); >- $session->param( 'number', $patron->borrowernumber ); >- $session->param( 'id', $patron->userid ); > $session->param( 'ip', '127.0.0.1' ); > $session->param( 'lasttime', time() ); > $session->flush; >@@ -70,6 +68,9 @@ subtest 'send_otp_token' => sub { > # Patron is not authenticated yet > $t->request_ok($tx)->status_is(401); > >+ # Patron is partially authenticated (credentials correct) >+ $session->param( 'number', $patron->borrowernumber ); >+ $session->param( 'id', $patron->userid ); > $session->param('waiting-for-2FA', 1); > $session->flush; > >@@ -108,6 +109,7 @@ subtest 'send_otp_token' => sub { > $t->request_ok($tx)->status_is(403); > $patron->flags(20)->store; > >+ # Patron is fully authenticated, cannot request a token again > $session->param('waiting-for-2FA', 0); > $session->flush; > $tx = $t->ua->build_tx( POST => "/api/v1/auth/otp/token_delivery" ); >-- >2.25.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 28787
:
135287
|
136571
|
136572
|
136573
|
137251
|
137330
|
137331
|
137369
|
137370
|
137371
|
137379
|
137380
|
137381
|
137391
|
137392
|
137393
|
137394
|
137395
|
137396
|
137397
|
137398
|
137399
|
137400
|
138146
|
138149
|
138150
|
138151
|
138152
|
138153
|
138154
|
138155
|
138156
|
138157
|
138158
|
138159
|
138689
|
138696
|
138697
|
138698
|
138699
|
138700
|
138701
|
138702
|
138703
|
138704
|
138705
|
138706
|
138707
|
138931
|
138932