|
Lines 47-52
my $t = Test::Mojo->new('Koha::REST::V1');
Link Here
|
| 47 |
|
47 |
|
| 48 |
my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; |
48 |
my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; |
| 49 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
49 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
|
|
50 |
my $branchcode2 = $builder->build({ source => 'Branch' })->{branchcode}; |
| 50 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; |
51 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; |
| 51 |
|
52 |
|
| 52 |
# Generic password for everyone |
53 |
# Generic password for everyone |
|
Lines 198-204
subtest "Test endpoints without permission" => sub {
Link Here
|
| 198 |
|
199 |
|
| 199 |
subtest "Test endpoints with permission" => sub { |
200 |
subtest "Test endpoints with permission" => sub { |
| 200 |
|
201 |
|
| 201 |
plan tests => 44; |
202 |
plan tests => 57; |
| 202 |
|
203 |
|
| 203 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
204 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
| 204 |
->status_is(200) |
205 |
->status_is(200) |
|
Lines 219-225
subtest "Test endpoints with permission" => sub {
Link Here
|
| 219 |
->status_is(200) |
220 |
->status_is(200) |
| 220 |
->json_is( '/hold_id', $reserve_id ) |
221 |
->json_is( '/hold_id', $reserve_id ) |
| 221 |
->json_is( '/suspended_until', $expected_suspended_until ) |
222 |
->json_is( '/suspended_until', $expected_suspended_until ) |
| 222 |
->json_is( '/priority', 2 ); |
223 |
->json_is( '/priority', 2 ) |
|
|
224 |
->json_is( '/pickup_library_id', $branchcode ); |
| 225 |
|
| 226 |
# Change only pickup library, everything else should remain |
| 227 |
$t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => { pickup_library_id => $branchcode2 } ) |
| 228 |
->status_is(200) |
| 229 |
->json_is( '/hold_id', $reserve_id ) |
| 230 |
->json_is( '/suspended_until', $expected_suspended_until ) |
| 231 |
->json_is( '/priority', 2 ) |
| 232 |
->json_is( '/pickup_library_id', $branchcode2 ); |
| 233 |
|
| 234 |
# Reset suspended_until, everything else should remain |
| 235 |
$t->put_ok( "//$userid_1:$password@/api/v1/holds/$reserve_id" => json => { suspended_until => undef } ) |
| 236 |
->status_is(200) |
| 237 |
->json_is( '/hold_id', $reserve_id ) |
| 238 |
->json_is( '/suspended_until', undef ) |
| 239 |
->json_is( '/priority', 2 ) |
| 240 |
->json_is( '/pickup_library_id', $branchcode2 ); |
| 223 |
|
241 |
|
| 224 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
242 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
| 225 |
->status_is(200); |
243 |
->status_is(200); |
| 226 |
- |
|
|