Lines 93-99
subtest 'list() tests' => sub {
Link Here
|
93 |
|
93 |
|
94 |
subtest 'delete_public() tests' => sub { |
94 |
subtest 'delete_public() tests' => sub { |
95 |
|
95 |
|
96 |
plan tests => 13; |
96 |
plan tests => 18; |
97 |
|
97 |
|
98 |
$schema->storage->txn_begin; |
98 |
$schema->storage->txn_begin; |
99 |
|
99 |
|
Lines 113-123
subtest 'delete_public() tests' => sub {
Link Here
|
113 |
my $deleted_hold_id = $hold_to_delete->id; |
113 |
my $deleted_hold_id = $hold_to_delete->id; |
114 |
$hold_to_delete->delete; |
114 |
$hold_to_delete->delete; |
115 |
|
115 |
|
|
|
116 |
$t->delete_ok( "/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id )->status_is(401) |
117 |
->json_is( { error => 'Authentication failure.' } ); |
118 |
|
116 |
$t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id ) |
119 |
$t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $deleted_hold_id ) |
117 |
->status_is(404); |
120 |
->status_is(404); |
118 |
|
121 |
|
119 |
my $another_user_hold = $builder->build_object( { class => 'Koha::Holds' } ); |
122 |
my $another_user_hold = $builder->build_object( { class => 'Koha::Holds' } ); |
120 |
|
123 |
|
|
|
124 |
$t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" |
125 |
. $another_user_hold->borrowernumber |
126 |
. '/holds/' |
127 |
. $another_user_hold->id ) |
128 |
->json_is( { error => "Unprivileged user cannot access another user's resources" } ); |
129 |
|
121 |
$t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $another_user_hold->id ) |
130 |
$t->delete_ok( "//$userid:$password@/api/v1/public/patrons/" . $patron->id . '/holds/' . $another_user_hold->id ) |
122 |
->status_is( 404, 'Invalid patron_id and hold_id combination yields 404' ); |
131 |
->status_is( 404, 'Invalid patron_id and hold_id combination yields 404' ); |
123 |
|
132 |
|
124 |
- |
|
|