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

(-)a/t/db_dependent/api/v1/acquisitions_vendors.t (-6 / +6 lines)
Lines 113-120 subtest 'list() and delete() tests | authorized user' => sub { Link Here
113
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
113
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
114
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
114
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
115
    $t->request_ok($tx)
115
    $t->request_ok($tx)
116
      ->status_is(200)
116
      ->status_is(204, 'SWAGGER3.2.4')
117
      ->content_is(q{""});
117
      ->content_is('', 'SWAGGER3.3.4');
118
118
119
    $tx = $t->ua->build_tx( GET => '/api/v1/acquisitions/vendors' );
119
    $tx = $t->ua->build_tx( GET => '/api/v1/acquisitions/vendors' );
120
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
120
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
Lines 128-135 subtest 'list() and delete() tests | authorized user' => sub { Link Here
128
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
128
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
129
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
129
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
130
    $t->request_ok($tx)
130
    $t->request_ok($tx)
131
      ->status_is(200)
131
      ->status_is(204, 'SWAGGER3.2.4')
132
      ->content_is(q{""});
132
      ->content_is('', 'SWAGGER3.3.4');
133
133
134
    $tx = $t->ua->build_tx( GET => '/api/v1/acquisitions/vendors' );
134
    $tx = $t->ua->build_tx( GET => '/api/v1/acquisitions/vendors' );
135
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
135
    $tx->req->cookies( { name => 'CGISESSID', value => $session_id } );
Lines 364-371 subtest 'delete() tests' => sub { Link Here
364
    $tx->req->cookies( { name => 'CGISESSID', value => $authorized_session_id } );
364
    $tx->req->cookies( { name => 'CGISESSID', value => $authorized_session_id } );
365
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
365
    $tx->req->env( { REMOTE_ADDR => $remote_address } );
366
    $t->request_ok($tx)
366
    $t->request_ok($tx)
367
      ->status_is(200)
367
      ->status_is(204, 'SWAGGER3.2.4')
368
      ->content_is(q{""});
368
      ->content_is('', 'SWAGGER3.3.4');
369
369
370
    $tx = $t->ua->build_tx( DELETE => "/api/v1/acquisitions/vendors/$vendor_id" );
370
    $tx = $t->ua->build_tx( DELETE => "/api/v1/acquisitions/vendors/$vendor_id" );
371
    $tx->req->cookies( { name => 'CGISESSID', value => $authorized_session_id } );
371
    $tx->req->cookies( { name => 'CGISESSID', value => $authorized_session_id } );
(-)a/t/db_dependent/api/v1/cities.t (-2 / +2 lines)
Lines 370-377 subtest 'delete() tests' => sub { Link Here
370
      ->status_is(403);
370
      ->status_is(403);
371
371
372
    $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")
372
    $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")
373
      ->status_is(200)
373
      ->status_is(204, 'SWAGGER3.2.4')
374
      ->content_is('""');
374
      ->content_is('', 'SWAGGER3.3.4');
375
375
376
    $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")
376
    $t->delete_ok("//$userid:$password@/api/v1/cities/$city_id")
377
      ->status_is(404);
377
      ->status_is(404);
(-)a/t/db_dependent/api/v1/holds.t (-9 / +12 lines)
Lines 199-205 subtest "Test endpoints without permission" => sub { Link Here
199
199
200
subtest "Test endpoints with permission" => sub {
200
subtest "Test endpoints with permission" => sub {
201
201
202
    plan tests => 57;
202
    plan tests => 59;
203
203
204
    $t->get_ok( "//$userid_1:$password@/api/v1/holds" )
204
    $t->get_ok( "//$userid_1:$password@/api/v1/holds" )
205
      ->status_is(200)
205
      ->status_is(200)
Lines 240-246 subtest "Test endpoints with permission" => sub { Link Here
240
      ->json_is( '/pickup_library_id', $branchcode2 );
240
      ->json_is( '/pickup_library_id', $branchcode2 );
241
241
242
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
242
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
243
      ->status_is(200);
243
      ->status_is(204, 'SWAGGER3.2.4')
244
      ->content_is('', 'SWAGGER3.3.4');
244
245
245
    $t->put_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $put_data )
246
    $t->put_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $put_data )
246
      ->status_is(404)
247
      ->status_is(404)
Lines 260-266 subtest "Test endpoints with permission" => sub { Link Here
260
      ->json_is([]);
261
      ->json_is([]);
261
262
262
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" )
263
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" )
263
      ->status_is(200);
264
      ->status_is(204, 'SWAGGER3.2.4')
265
      ->content_is('', 'SWAGGER3.3.4');
264
266
265
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
267
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
266
      ->status_is(201)
268
      ->status_is(201)
Lines 287-293 subtest "Test endpoints with permission" => sub { Link Here
287
};
289
};
288
290
289
subtest 'Reserves with itemtype' => sub {
291
subtest 'Reserves with itemtype' => sub {
290
    plan tests => 9;
292
    plan tests => 10;
291
293
292
    my $post_data = {
294
    my $post_data = {
293
        patron_id => int($patron_1->borrowernumber),
295
        patron_id => int($patron_1->borrowernumber),
Lines 297-303 subtest 'Reserves with itemtype' => sub { Link Here
297
    };
299
    };
298
300
299
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
301
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
300
      ->status_is(200);
302
      ->status_is(204, 'SWAGGER3.2.4')
303
      ->content_is('', 'SWAGGER3.3.4');
301
304
302
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
305
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
303
      ->status_is(201)
306
      ->status_is(201)
Lines 427-434 subtest 'suspend and resume tests' => sub { Link Here
427
    );
430
    );
428
431
429
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
432
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
430
      ->status_is( 204, "Correct status when deleting a resource" )
433
      ->status_is(204, 'SWAGGER3.2.4')
431
      ->json_is( undef );
434
      ->content_is('', 'SWAGGER3.3.4');
432
435
433
    # Pass a an expiration date for the suspension
436
    # Pass a an expiration date for the suspension
434
    my $date = dt_from_string()->add( days => 5 );
437
    my $date = dt_from_string()->add( days => 5 );
Lines 445-452 subtest 'suspend and resume tests' => sub { Link Here
445
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
448
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
446
449
447
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
450
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
448
      ->status_is( 204, "Correct status when deleting a resource" )
451
      ->status_is(204, 'SWAGGER3.2.4')
449
      ->json_is( undef );
452
      ->content_is('', 'SWAGGER3.3.4');
450
453
451
    $hold->set_waiting->discard_changes;
454
    $hold->set_waiting->discard_changes;
452
455
(-)a/t/db_dependent/api/v1/patrons.t (-3 / +3 lines)
Lines 342-348 subtest 'delete() tests' => sub { Link Here
342
    $schema->storage->txn_rollback;
342
    $schema->storage->txn_rollback;
343
343
344
    subtest 'librarian access test' => sub {
344
    subtest 'librarian access test' => sub {
345
        plan tests => 4;
345
        plan tests => 5;
346
346
347
        $schema->storage->txn_begin;
347
        $schema->storage->txn_begin;
348
348
Lines 363-369 subtest 'delete() tests' => sub { Link Here
363
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
363
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
364
364
365
        $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber)
365
        $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber)
366
          ->status_is(200, 'Patron deleted successfully');
366
          ->status_is(204, 'SWAGGER3.2.4')
367
          ->content_is('', 'SWAGGER3.3.4');
367
368
368
        $schema->storage->txn_rollback;
369
        $schema->storage->txn_rollback;
369
    };
370
    };
370
- 

Return to bug 25048