Bugzilla – Attachment 162735 Details for
Bug 36066
REST API: We should only allow deleting cancelled order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36066: Add tests
Bug-36066-Add-tests.patch (text/plain), 2.10 KB, created by
Victor Grousset/tuxayo
on 2024-03-04 22:59:13 UTC
(
hide
)
Description:
Bug 36066: Add tests
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-03-04 22:59:13 UTC
Size:
2.10 KB
patch
obsolete
>From c76a7ffe9b69983226c5d2984746688e98238dde Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 12 Feb 2024 09:54:04 +0000 >Subject: [PATCH] Bug 36066: Add tests > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/api/v1/acquisitions_orders.t | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/api/v1/acquisitions_orders.t b/t/db_dependent/api/v1/acquisitions_orders.t >index 40a6ec6685..20dde16ac6 100755 >--- a/t/db_dependent/api/v1/acquisitions_orders.t >+++ b/t/db_dependent/api/v1/acquisitions_orders.t >@@ -72,9 +72,9 @@ subtest 'list() tests' => sub { > $another_order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => $another_order }); > > ## Authorized user tests >- my $count_of_orders = Koha::Acquisition::Orders->search->count; >+ my $count_of_orders = Koha::Acquisition::Orders->search( { orderstatus => 'new' } )->count; > # Make sure we are returned with the correct amount of orders >- $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_per_page=-1" ) >+ $t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?status=new&_per_page=-1" ) > ->status_is( 200, 'SWAGGER3.2.2' ) > ->json_has('/'.($count_of_orders-1).'/order_id') > ->json_hasnt('/'.($count_of_orders).'/order_id'); >@@ -449,7 +449,7 @@ subtest 'update() tests' => sub { > }; > > subtest 'delete() tests' => sub { >- plan tests => 7; >+ plan tests => 9; > > $schema->storage->txn_begin; > >@@ -474,6 +474,11 @@ subtest 'delete() tests' => sub { > $t->delete_ok( "//$unauth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) > ->status_is(403); > >+ # Check if status is cancelled? >+ $order->orderstatus('new')->store; >+ $t->delete_ok( "//$unauth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(403); >+ >+ $order->orderstatus('cancelled')->store; > $t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) > ->status_is(204, 'SWAGGER3.2.4') > ->content_is('', 'SWAGGER3.3.4'); >-- >2.44.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 36066
:
162017
|
162276
|
162735
|
162736
|
162738
|
162739
|
162754
|
162790
|
162791
|
162792