Bugzilla – Attachment 129136 Details for
Bug 29464
GET /acquisitions/orders doesn't honour sorting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29464: Regression tests
Bug-29464-Regression-tests.patch (text/plain), 3.17 KB, created by
Jonathan Druart
on 2022-01-07 11:15:13 UTC
(
hide
)
Description:
Bug 29464: Regression tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-07 11:15:13 UTC
Size:
3.17 KB
patch
obsolete
>From 6f6f6ce2f52bee55a0098805771b2ae49a2e0146 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 10 Dec 2021 10:15:42 -0300 >Subject: [PATCH] Bug 29464: Regression tests > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/api/v1/acquisitions_orders.t | 59 ++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/acquisitions_orders.t b/t/db_dependent/api/v1/acquisitions_orders.t >index 9c806a53ccb..398f918b970 100755 >--- a/t/db_dependent/api/v1/acquisitions_orders.t >+++ b/t/db_dependent/api/v1/acquisitions_orders.t >@@ -37,7 +37,8 @@ t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); > my $t = Test::Mojo->new('Koha::REST::V1'); > > subtest 'list() tests' => sub { >- plan tests => 18; >+ >+ plan tests => 19; > > $schema->storage->txn_begin; > >@@ -134,6 +135,62 @@ subtest 'list() tests' => sub { > ->status_is(400) > ->json_is( [{ path => '/query/order_blah', message => 'Malformed query string'}] ); > >+ subtest 'sorting tests' => sub { >+ >+ plan tests => 10; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio_1 = $builder->build_sample_biblio(); >+ my $biblio_2 = $builder->build_sample_biblio(); >+ >+ my $basket = $builder->build_object({ class => 'Koha::Acquisition::Baskets', value => { is_standing => 1 } }); >+ my $order_1 = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ basketno => $basket->basketno, >+ orderstatus => 'new', >+ biblionumber => $biblio_1->biblionumber >+ } >+ } >+ ); >+ my $order_2 = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { >+ basketno => $basket->basketno, >+ orderstatus => 'new', >+ biblionumber => $biblio_2->biblionumber >+ } >+ } >+ ); >+ >+ # order by order_id >+ my $result = >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_order_by=+me.order_id&basket_id=" . $basket->id ) >+ ->status_is( 200, "query successful" ) >+ ->tx->res->json; >+ >+ is( scalar @$result, 2, 'Two elements returned' ); >+ >+ is( $result->[0]->{order_id}, $order_1->id, 'The first element is order_1' ); >+ is( $result->[1]->{order_id}, $order_2->id, 'The second element is order_2' ); >+ >+ # now reverse order >+ $result = >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_order_by=-me.order_id&basket_id=" . $basket->id ) >+ ->status_is( 200, "query successful" ) >+ ->tx->res->json; >+ >+ is( scalar @$result, 2, 'Two elements returned' ); >+ >+ is( $result->[0]->{order_id}, $order_2->id, 'The first element is order_2' ); >+ is( $result->[1]->{order_id}, $order_1->id, 'The second element is order_1' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+ > $schema->storage->txn_rollback; > }; > >-- >2.25.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 29464
:
128395
|
128396
|
128397
|
128398
| 129136 |
129137