Bugzilla – Attachment 115811 Details for
Bug 27352
Add GET /biblios/:biblio_id/items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27352: Unit tests
Bug-27352-Unit-tests.patch (text/plain), 2.14 KB, created by
Martin Renvoize (ashimema)
on 2021-01-26 12:52:09 UTC
(
hide
)
Description:
Bug 27352: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-01-26 12:52:09 UTC
Size:
2.14 KB
patch
obsolete
>From 3fd3f6c882767820e68146a08d6407f0c4183b39 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 6 Jan 2021 13:10:12 -0300 >Subject: [PATCH] Bug 27352: Unit tests > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/api/v1/biblios.t | 39 ++++++++++++++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index 66d423d25f..fa75ff4dd4 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use Test::Mojo; > use Test::Warn; >@@ -103,6 +103,43 @@ subtest 'get() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'get_items() tests' => sub { >+ >+ plan tests => 8; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { flags => 0 } >+ } >+ ); >+ my $password = 'thePassword123'; >+ $patron->set_password( { password => $password, skip_validation => 1 } ); >+ $patron->discard_changes; >+ my $userid = $patron->userid; >+ >+ my $biblio = $builder->build_sample_biblio(); >+ $t->get_ok("//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") >+ ->status_is(403); >+ >+ $patron->flags(4)->store; >+ >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") >+ ->status_is(200) >+ ->json_is( '' => [], 'No items on the biblio' ); >+ >+ my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >+ my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >+ >+ $t->get_ok( "//$userid:$password@/api/v1/biblios/" . $biblio->biblionumber . "/items") >+ ->status_is(200) >+ ->json_is( '' => [ $item_1->to_api, $item_2->to_api ], 'The items are returned' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'delete() tests' => sub { > > plan tests => 9; >-- >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 27352
:
114892
|
114894
|
114895
|
114983
|
114984
|
114985
|
115810
| 115811 |
115812