Bugzilla – Attachment 85024 Details for
Bug 22132
Add Basic authentication to the REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[18.05.x] Bug 22132: (follow-up) Make tests use Koha::Patron->update_password
1805x-Bug-22132-follow-up-Make-tests-use-KohaPatro.patch (text/plain), 2.01 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-02-12 17:19:45 UTC
(
hide
)
Description:
[18.05.x] Bug 22132: (follow-up) Make tests use Koha::Patron->update_password
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-02-12 17:19:45 UTC
Size:
2.01 KB
patch
obsolete
>From 43c2d305ef2ff42a3e4ba2fda5d1ad4ceeb907d1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 12 Feb 2019 14:19:26 -0300 >Subject: [PATCH] [18.05.x] Bug 22132: (follow-up) Make tests use > Koha::Patron->update_password > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/api/v1/auth_basic.t | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/auth_basic.t b/t/db_dependent/api/v1/auth_basic.t >index 4fb48f0277..48ff1af6db 100644 >--- a/t/db_dependent/api/v1/auth_basic.t >+++ b/t/db_dependent/api/v1/auth_basic.t >@@ -23,6 +23,8 @@ use Test::Mojo; > use t::lib::TestBuilder; > use t::lib::Mocks; > >+use Koha::AuthUtils; >+ > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > >@@ -37,11 +39,12 @@ subtest 'success tests' => sub { > t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); > > my $password = 'AbcdEFG123'; >+ my $digest = Koha::AuthUtils::hash_password( $password ); > > my $patron = $builder->build_object( > { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4 } } ); >- $patron->set_password({ password => $password }); > my $userid = $patron->userid; >+ $patron->update_password( $userid, $digest ); > > $t->get_ok("//$userid:$password@/api/v1/patrons") > ->status_is( 200, 'Successful authentication and permissions check' ); >@@ -66,13 +69,14 @@ subtest 'failure tests' => sub { > > my $password = 'AbcdEFG123'; > my $bad_password = '123456789'; >+ my $digest = Koha::AuthUtils::hash_password( $password ); > > t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); > > my $patron = $builder->build_object( > { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 2**4 } } ); >- $patron->set_password({ password => $password }); > my $userid = $patron->userid; >+ $patron->update_password( $userid, $digest ); > > $t->get_ok("//@/api/v1/patrons") > ->status_is( 401, 'No credentials passed' ); >-- >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 22132
:
83989
|
83990
|
83991
|
83993
|
83994
|
83995
|
84353
|
84354
|
84355
|
84361
|
84362
|
84363
|
84364
|
84365
|
84368
|
84369
|
84371
|
84535
|
84536
|
84537
|
84538
|
84539
| 85024