Lines 72-80
subtest 'list() tests' => sub {
Link Here
|
72 |
$another_order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => $another_order }); |
72 |
$another_order = $builder->build_object({ class => 'Koha::Acquisition::Orders', value => $another_order }); |
73 |
|
73 |
|
74 |
## Authorized user tests |
74 |
## Authorized user tests |
75 |
my $count_of_orders = Koha::Acquisition::Orders->search->count; |
75 |
my $count_of_orders = Koha::Acquisition::Orders->search( { orderstatus => 'new' } )->count; |
76 |
# Make sure we are returned with the correct amount of orders |
76 |
# Make sure we are returned with the correct amount of orders |
77 |
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?_per_page=-1" ) |
77 |
$t->get_ok( "//$userid:$password@/api/v1/acquisitions/orders?status=new&_per_page=-1" ) |
78 |
->status_is( 200, 'SWAGGER3.2.2' ) |
78 |
->status_is( 200, 'SWAGGER3.2.2' ) |
79 |
->json_has('/'.($count_of_orders-1).'/order_id') |
79 |
->json_has('/'.($count_of_orders-1).'/order_id') |
80 |
->json_hasnt('/'.($count_of_orders).'/order_id'); |
80 |
->json_hasnt('/'.($count_of_orders).'/order_id'); |
Lines 449-455
subtest 'update() tests' => sub {
Link Here
|
449 |
}; |
449 |
}; |
450 |
|
450 |
|
451 |
subtest 'delete() tests' => sub { |
451 |
subtest 'delete() tests' => sub { |
452 |
plan tests => 7; |
452 |
plan tests => 9; |
453 |
|
453 |
|
454 |
$schema->storage->txn_begin; |
454 |
$schema->storage->txn_begin; |
455 |
|
455 |
|
Lines 474-479
subtest 'delete() tests' => sub {
Link Here
|
474 |
$t->delete_ok( "//$unauth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) |
474 |
$t->delete_ok( "//$unauth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) |
475 |
->status_is(403); |
475 |
->status_is(403); |
476 |
|
476 |
|
|
|
477 |
# Check if status is cancelled? |
478 |
$order->orderstatus('new')->store; |
479 |
$t->delete_ok( "//$unauth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber )->status_is(403); |
480 |
|
481 |
$order->orderstatus('cancelled')->store; |
477 |
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) |
482 |
$t->delete_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders/" . $order->ordernumber ) |
478 |
->status_is(204, 'SWAGGER3.2.4') |
483 |
->status_is(204, 'SWAGGER3.2.4') |
479 |
->content_is('', 'SWAGGER3.3.4'); |
484 |
->content_is('', 'SWAGGER3.3.4'); |
480 |
- |
|
|