|
Lines 354-359
subtest 'PUT /holds/{hold_id}/priority tests' => sub {
Link Here
|
| 354 |
|
354 |
|
| 355 |
my $password = 'AbcdEFG123'; |
355 |
my $password = 'AbcdEFG123'; |
| 356 |
|
356 |
|
|
|
357 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 357 |
my $patron_np = $builder->build_object( |
358 |
my $patron_np = $builder->build_object( |
| 358 |
{ class => 'Koha::Patrons', value => { flags => 0 } } ); |
359 |
{ class => 'Koha::Patrons', value => { flags => 0 } } ); |
| 359 |
$patron_np->set_password( { password => $password, skip_validation => 1 } ); |
360 |
$patron_np->set_password( { password => $password, skip_validation => 1 } ); |
|
Lines 378-422
subtest 'PUT /holds/{hold_id}/priority tests' => sub {
Link Here
|
| 378 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
379 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
| 379 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
380 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
| 380 |
|
381 |
|
| 381 |
my $biblio = $builder->build_sample_biblio; |
382 |
my $biblio = $builder->build_sample_biblio; |
| 382 |
|
383 |
my $patron_1 = $builder->build_object( |
| 383 |
my $hold_1 = $builder->build_object( |
|
|
| 384 |
{ |
384 |
{ |
| 385 |
class => 'Koha::Holds', |
385 |
class => 'Koha::Patrons', |
| 386 |
value => { |
386 |
value => { branchcode => $library->branchcode } |
| 387 |
suspend => 0, |
|
|
| 388 |
suspend_until => undef, |
| 389 |
waitingdate => undef, |
| 390 |
biblionumber => $biblio->biblionumber, |
| 391 |
priority => 1 |
| 392 |
} |
| 393 |
} |
387 |
} |
| 394 |
); |
388 |
); |
| 395 |
my $hold_2 = $builder->build_object( |
389 |
my $patron_2 = $builder->build_object( |
| 396 |
{ |
390 |
{ |
| 397 |
class => 'Koha::Holds', |
391 |
class => 'Koha::Patrons', |
| 398 |
value => { |
392 |
value => { branchcode => $library->branchcode } |
| 399 |
suspend => 0, |
|
|
| 400 |
suspend_until => undef, |
| 401 |
waitingdate => undef, |
| 402 |
biblionumber => $biblio->biblionumber, |
| 403 |
priority => 2 |
| 404 |
} |
| 405 |
} |
393 |
} |
| 406 |
); |
394 |
); |
| 407 |
my $hold_3 = $builder->build_object( |
395 |
my $patron_3 = $builder->build_object( |
| 408 |
{ |
396 |
{ |
| 409 |
class => 'Koha::Holds', |
397 |
class => 'Koha::Patrons', |
| 410 |
value => { |
398 |
value => { branchcode => $library->branchcode } |
| 411 |
suspend => 0, |
|
|
| 412 |
suspend_until => undef, |
| 413 |
waitingdate => undef, |
| 414 |
biblionumber => $biblio->biblionumber, |
| 415 |
priority => 3 |
| 416 |
} |
| 417 |
} |
399 |
} |
| 418 |
); |
400 |
); |
| 419 |
|
401 |
|
|
|
402 |
my $hold_1 = Koha::Holds->find( |
| 403 |
AddReserve( |
| 404 |
$library->branchcode, $patron_1->borrowernumber, |
| 405 |
$biblio->biblionumber, undef, |
| 406 |
1 |
| 407 |
) |
| 408 |
); |
| 409 |
my $hold_2 = Koha::Holds->find( |
| 410 |
AddReserve( |
| 411 |
$library->branchcode, $patron_2->borrowernumber, |
| 412 |
$biblio->biblionumber, undef, |
| 413 |
2 |
| 414 |
) |
| 415 |
); |
| 416 |
my $hold_3 = Koha::Holds->find( |
| 417 |
AddReserve( |
| 418 |
$library->branchcode, $patron_3->borrowernumber, |
| 419 |
$biblio->biblionumber, undef, |
| 420 |
3 |
| 421 |
) |
| 422 |
); |
| 423 |
|
| 420 |
$t->put_ok( "//$userid_np:$password@/api/v1/holds/" |
424 |
$t->put_ok( "//$userid_np:$password@/api/v1/holds/" |
| 421 |
. $hold_3->id |
425 |
. $hold_3->id |
| 422 |
. "/priority" => json => 1 )->status_is(403); |
426 |
. "/priority" => json => 1 )->status_is(403); |
| 423 |
- |
|
|