View | Details | Raw Unified | Return to bug 18330
Collapse All | Expand All

(-)a/t/db_dependent/api/v1/holds.t (-11 / +23 lines)
Lines 28-33 use C4::Context; Link Here
28
use C4::Reserves;
28
use C4::Reserves;
29
29
30
use Koha::Database;
30
use Koha::Database;
31
use Koha::DateUtils;
31
use Koha::Biblios;
32
use Koha::Biblios;
32
use Koha::Biblioitems;
33
use Koha::Biblioitems;
33
use Koha::Items;
34
use Koha::Items;
Lines 219-229 subtest "Test endpoints without permission, but accessing own object" => sub { Link Here
219
    my $reserve_id3 = Koha::Holds->find({ borrowernumber => $nopermission->{borrowernumber} })->reserve_id;
220
    my $reserve_id3 = Koha::Holds->find({ borrowernumber => $nopermission->{borrowernumber} })->reserve_id;
220
    $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id3" => json => $put_data);
221
    $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id3" => json => $put_data);
221
    $tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id});
222
    $tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id});
222
    $t->request_ok($tx) # create hold to myself
223
    $t->request_ok($tx)    # create hold to myself
223
      ->status_is(200)
224
      ->status_is(200)->json_is( '/reserve_id', $reserve_id3 )->json_is(
224
      ->json_is('/reserve_id', $reserve_id3)
225
        '/suspend_until',
225
      ->json_is('/suspend_until', $suspend_until . ' 00:00:00')
226
        output_pref(
226
      ->json_is('/priority', 2);
227
            {
228
                dateformat => 'rfc3339',
229
                dt => dt_from_string( $suspend_until . ' 00:00:00', 'sql' )
230
            }
231
        )
232
      )
233
      ->json_is( '/priority', 2 );
227
};
234
};
228
235
229
subtest "Test endpoints with permission" => sub {
236
subtest "Test endpoints with permission" => sub {
Lines 247-257 subtest "Test endpoints with permission" => sub { Link Here
247
254
248
    $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id" => json => $put_data);
255
    $tx = $t->ua->build_tx(PUT => "/api/v1/holds/$reserve_id" => json => $put_data);
249
    $tx->req->cookies({name => 'CGISESSID', value => $session3->id});
256
    $tx->req->cookies({name => 'CGISESSID', value => $session3->id});
250
    $t->request_ok($tx)
257
    $t->request_ok($tx)->status_is(200)->json_is( '/reserve_id', $reserve_id )
251
      ->status_is(200)
258
      ->json_is(
252
      ->json_is('/reserve_id', $reserve_id)
259
        '/suspend_until',
253
      ->json_is('/suspend_until', $suspend_until . ' 00:00:00')
260
        output_pref(
254
      ->json_is('/priority', 2);
261
            {
262
                dateformat => 'rfc3339',
263
                dt => dt_from_string( $suspend_until . ' 00:00:00', 'sql' )
264
            }
265
        )
266
      )
267
      ->json_is( '/priority', 2 );
255
268
256
    $tx = $t->ua->build_tx(DELETE => "/api/v1/holds/$reserve_id");
269
    $tx = $t->ua->build_tx(DELETE => "/api/v1/holds/$reserve_id");
257
    $tx->req->cookies({name => 'CGISESSID', value => $session3->id});
270
    $tx->req->cookies({name => 'CGISESSID', value => $session3->id});
258
- 

Return to bug 18330