Bugzilla – Attachment 96853 Details for
Bug 18731
Add routes for acquisition orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18731: Make authenticate_api_request stash the embed structure
Bug-18731-Make-authenticateapirequest-stash-the-em.patch (text/plain), 2.72 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-01-06 17:10:47 UTC
(
hide
)
Description:
Bug 18731: Make authenticate_api_request stash the embed structure
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-01-06 17:10:47 UTC
Size:
2.72 KB
patch
obsolete
>From 81ede79f675b3abb6f163fc249f0c554f12325e9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 30 Dec 2019 15:34:43 -0300 >Subject: [PATCH] Bug 18731: Make authenticate_api_request stash the embed > structure > >--- > Koha/REST/V1/Auth.pm | 3 +++ > .../api/v1/auth_authenticate_api_request.t | 13 ++++++++----- > 2 files changed, 11 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm >index 8bffc977da..57aea11905 100644 >--- a/Koha/REST/V1/Auth.pm >+++ b/Koha/REST/V1/Auth.pm >@@ -137,6 +137,9 @@ sub authenticate_api_request { > my $user; > > my $spec = $c->match->endpoint->pattern->defaults->{'openapi.op_spec'}; >+ >+ $c->stash_embed({ spec => $spec }); >+ > my $authorization = $spec->{'x-koha-authorization'}; > > my $authorization_header = $c->req->headers->authorization; >diff --git a/t/db_dependent/api/v1/auth_authenticate_api_request.t b/t/db_dependent/api/v1/auth_authenticate_api_request.t >index 8583125a9f..f688e209f5 100755 >--- a/t/db_dependent/api/v1/auth_authenticate_api_request.t >+++ b/t/db_dependent/api/v1/auth_authenticate_api_request.t >@@ -44,7 +44,7 @@ t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' ); > subtest 'token-based tests' => sub { > > if ( can_load( modules => { 'Net::OAuth2::AuthorizationServer' => undef } ) ) { >- plan tests => 10; >+ plan tests => 12; > } > else { > plan skip_all => 'Net::OAuth2::AuthorizationServer not available'; >@@ -54,9 +54,7 @@ subtest 'token-based tests' => sub { > > my $patron = $builder->build_object({ > class => 'Koha::Patrons', >- value => { >- flags => 16 # no permissions >- }, >+ value => { flags => 1 }, > }); > > t::lib::Mocks::mock_preference('RESTOAuth2ClientCredentials', 1); >@@ -81,8 +79,9 @@ subtest 'token-based tests' => sub { > > my $stash; > >- my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); >+ my $tx = $t->ua->build_tx(GET => '/api/v1/acquisitions/orders'); > $tx->req->headers->authorization("Bearer $access_token"); >+ $tx->req->headers->header( 'x-koha-embed' => 'fund' ); > > $t->app->hook(after_dispatch => sub { $stash = shift->stash }); > $t->request_ok($tx)->status_is(200); >@@ -92,6 +91,10 @@ subtest 'token-based tests' => sub { > is( ref($user), 'Koha::Patron', 'Stashed koha.user object type is Koha::Patron') and > is( $user->borrowernumber, $patron->borrowernumber, 'The stashed user is the right one' ); > >+ my $embed = $stash->{'koha.embed'}; >+ ok( defined $embed, 'The embed hashref is generated and stashed' ); >+ is_deeply( $embed, { fund => {} }, 'The embed data structure is correct' ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.24.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 18731
:
69184
|
69185
|
69309
|
69310
|
69544
|
73959
|
73960
|
78435
|
78436
|
84133
|
84134
|
95054
|
95055
|
95056
|
96853
|
96854
|
96855
|
96856
|
96857
|
96858
|
96916
|
96917
|
96918
|
96938
|
96961
|
96962
|
96963
|
96964
|
96965
|
96966
|
97107
|
97108
|
97109
|
97110
|
97111
|
97112
|
97113
|
97331