Bugzilla – Attachment 74051 Details for
Bug 20402
OAuth2 client credentials grant for REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20402: Fix oauth.t
Bug-20402-Fix-oautht.patch (text/plain), 2.05 KB, created by
Julian Maurice
on 2018-04-12 07:25:33 UTC
(
hide
)
Description:
Bug 20402: Fix oauth.t
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-04-12 07:25:33 UTC
Size:
2.05 KB
patch
obsolete
>From 8e5d04083e64d1a4c46495351216b3488e069ec6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 12 Apr 2018 09:17:43 +0200 >Subject: [PATCH] Bug 20402: Fix oauth.t > >GET /patrons now requires { "borrowers": 1 } instead of >{ "borrowers": "edit_borrowers" } >--- > t/db_dependent/api/v1/oauth.t | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/api/v1/oauth.t b/t/db_dependent/api/v1/oauth.t >index 79d9eceb02..693bccb3e7 100755 >--- a/t/db_dependent/api/v1/oauth.t >+++ b/t/db_dependent/api/v1/oauth.t >@@ -21,6 +21,7 @@ use Test::More tests => 1; > use Test::Mojo; > > use Koha::Database; >+use Koha::Patrons; > > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -34,13 +35,14 @@ subtest '/oauth/token tests' => sub { > > $schema->storage->txn_begin; > >- my $patron = $builder->build({ >+ my $borrower = $builder->build({ > source => 'Borrower', > value => { > surname => 'Test OAuth', > flags => 0, > }, > }); >+ my $patron = Koha::Patrons->find($borrower->{borrowernumber}); > > # Missing parameter grant_type > $t->post_ok('/api/v1/oauth/token') >@@ -60,7 +62,7 @@ subtest '/oauth/token tests' => sub { > t::lib::Mocks::mock_config('api_client', { > 'client_id' => $client_id, > 'client_secret' => $client_secret, >- patron_id => $patron->{borrowernumber}, >+ patron_id => $patron->borrowernumber, > }); > > my $formData = { >@@ -85,14 +87,7 @@ subtest '/oauth/token tests' => sub { > $t->request_ok($tx)->status_is(403); > > # With access token and permissions, it returns 200 >- $builder->build({ >- source => 'UserPermission', >- value => { >- borrowernumber => $patron->{borrowernumber}, >- module_bit => 4, # borrowers >- code => 'edit_borrowers', >- }, >- }); >+ $patron->flags(2**4)->store; > $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); > $tx->req->headers->authorization("Bearer $access_token"); > $t->request_ok($tx)->status_is(200); >-- >2.14.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 20402
:
72865
|
72874
|
72886
|
72887
|
72888
|
72892
|
72893
|
72894
|
73086
|
73087
|
74009
|
74018
|
74050
|
74051
|
74069
|
74070
|
74088
|
74365
|
74366
|
74367
|
74368
|
74369
|
74380
|
74381
|
74382
|
74383
|
74384
|
74385
|
74386
|
74600
|
75026
|
75027
|
75028
|
75029
|
75030
|
75031
|
75032
|
75033
|
75189