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

(-)a/t/db_dependent/api/v1/holds.t (-3 / +68 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 13;
20
use Test::More tests => 14;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Mojo;
22
use Test::Mojo;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
Lines 461-467 subtest 'suspend and resume tests' => sub { Link Here
461
    my $password = 'AbcdEFG123';
461
    my $password = 'AbcdEFG123';
462
462
463
    my $patron = $builder->build_object(
463
    my $patron = $builder->build_object(
464
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 1 } } );
464
        { class => 'Koha::Patrons', value => { userid => 'tomasito', flags => 0 } } );
465
    $builder->build(
466
        {
467
            source => 'UserPermission',
468
            value  => {
469
                borrowernumber => $patron->borrowernumber,
470
                module_bit     => 6,
471
                code           => 'place_holds',
472
            },
473
        }
474
    );
475
465
    $patron->set_password({ password => $password, skip_validation => 1 });
476
    $patron->set_password({ password => $password, skip_validation => 1 });
466
    my $userid = $patron->userid;
477
    my $userid = $patron->userid;
467
478
Lines 1363-1365 subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { Link Here
1363
1374
1364
    $schema->storage->txn_rollback;
1375
    $schema->storage->txn_rollback;
1365
};
1376
};
1366
- 
1377
1378
subtest 'delete() tests' => sub {
1379
1380
    plan tests => 3;
1381
1382
    $schema->storage->txn_begin;
1383
1384
    my $password = 'AbcdEFG123';
1385
    my $patron   = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 } });
1386
    $patron->set_password({ password => $password, skip_validation => 1 });
1387
    my $userid = $patron->userid;
1388
1389
    # Only have 'place_holds' subpermission
1390
    $builder->build(
1391
        {
1392
            source => 'UserPermission',
1393
            value  => {
1394
                borrowernumber => $patron->borrowernumber,
1395
                module_bit     => 6,
1396
                code           => 'place_holds',
1397
            },
1398
        }
1399
    );
1400
1401
    # Disable logging
1402
    t::lib::Mocks::mock_preference( 'HoldsLog',      0 );
1403
    t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
1404
1405
    my $biblio = $builder->build_sample_biblio;
1406
    my $item   = $builder->build_sample_item(
1407
        {
1408
            biblionumber => $biblio->biblionumber,
1409
            library      => $patron->branchcode
1410
        }
1411
    );
1412
1413
    # Add a hold
1414
    my $hold = Koha::Holds->find(
1415
        AddReserve(
1416
            {
1417
                branchcode     => $patron->branchcode,
1418
                borrowernumber => $patron->borrowernumber,
1419
                biblionumber   => $biblio->biblionumber,
1420
                priority       => 1,
1421
                itemnumber     => undef,
1422
            }
1423
        )
1424
    );
1425
1426
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )
1427
      ->status_is(204, 'SWAGGER3.2.4')
1428
      ->content_is('', 'SWAGGER3.3.4');
1429
1430
    $schema->storage->txn_rollback;
1431
};

Return to bug 30780