Bugzilla – Attachment 87542 Details for
Bug 18205
Use Koha::Logger/Log4Perl using Mojolicious app log method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18205: (follow-up) Tests for V1 setting the right interface
Bug-18205-follow-up-Tests-for-V1-setting-the-right.patch (text/plain), 2.58 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-04-08 18:40:29 UTC
(
hide
)
Description:
Bug 18205: (follow-up) Tests for V1 setting the right interface
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-04-08 18:40:29 UTC
Size:
2.58 KB
patch
obsolete
>From 5cc5d0708b830b9ee70afb437183ce06ea88eb58 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 8 Apr 2019 15:38:22 -0300 >Subject: [PATCH] Bug 18205: (follow-up) Tests for V1 setting the right > interface > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/REST/V1.t | 49 ++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/REST/V1.t b/t/db_dependent/Koha/REST/V1.t >index faddea9da3..3fc6ce035d 100644 >--- a/t/db_dependent/Koha/REST/V1.t >+++ b/t/db_dependent/Koha/REST/V1.t >@@ -17,12 +17,25 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 2; > use Test::Mojo; > use Test::Warn; > >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+use Koha::ActionLogs; >+use Koha::Database; >+ > use JSON::Validator::OpenAPI::Mojolicious; > >+my $builder = t::lib::TestBuilder->new; >+my $schema = Koha::Database->new->schema; >+ >+t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); >+ >+my $t = Test::Mojo->new('Koha::REST::V1'); >+ > subtest 'Type definition tests' => sub { > > plan tests => 4; >@@ -42,3 +55,37 @@ subtest 'Type definition tests' => sub { > is( $types->type('mij'), 'application/marc-in-json', 'application/marc-in-json is defined' ); > is( $types->type('marc'), 'application/marc', 'application/marc is defined' ); > }; >+ >+subtest 'logging with the right interface' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $user = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 1 } } ); >+ my $userid = $user->userid; >+ my $password = 'thisIsaPassword!234'; >+ $user->set_password( { password => $password, skip_validation => 1 } ); >+ >+ # create a known patron >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ # Make changes to the patron through the API >+ $t->put_ok( >+ "//$userid:$password@/api/v1/patrons/" >+ . $patron->borrowernumber => json => { >+ surname => 'This is a new firstname', >+ address => 'An address', >+ city => $patron->city, >+ library_id => $patron->branchcode, >+ category_id => $patron->categorycode >+ } >+ )->status_is(200); >+ >+ my $log = Koha::ActionLogs->search( >+ { module => 'MEMBERS', action => 'MODIFY', object => $patron->borrowernumber } )->next; >+ is( $log->interface, 'api', 'Interface correctly logged' ); >+ is( $log->user, $user->borrowernumber, 'User correctly logged' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.21.0
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 18205
:
60848
|
60849
|
60850
|
69226
|
69227
|
69228
|
69232
|
85711
|
85712
|
85713
|
85714
|
87537
|
87538
|
87539
|
87540
|
87541
| 87542 |
87545
|
139811