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

(-)a/t/db_dependent/api/v1/authorities.t (-3 / +3 lines)
Lines 202-208 subtest 'post() tests' => sub { Link Here
202
      ->json_is(q{})
202
      ->json_is(q{})
203
      ->header_like(
203
      ->header_like(
204
          Location => qr|^\/api\/v1\/authorities/\d*|,
204
          Location => qr|^\/api\/v1\/authorities/\d*|,
205
          'SWAGGER3.4.1'
205
          'REST3.4.1'
206
      );
206
      );
207
207
208
    # x-koha-override not passed to force block because duplicate
208
    # x-koha-override not passed to force block because duplicate
Lines 217-223 subtest 'post() tests' => sub { Link Here
217
      ->json_is(q{})
217
      ->json_is(q{})
218
      ->header_like(
218
      ->header_like(
219
          Location => qr|^\/api\/v1\/authorities/\d*|,
219
          Location => qr|^\/api\/v1\/authorities/\d*|,
220
          'SWAGGER3.4.1'
220
          'REST3.4.1'
221
      );
221
      );
222
222
223
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', 'x-authority-type' => 'CORPO_NAME', 'x-koha-override' => 'duplicate' } => $marc)
223
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', 'x-authority-type' => 'CORPO_NAME', 'x-koha-override' => 'duplicate' } => $marc)
Lines 225-231 subtest 'post() tests' => sub { Link Here
225
      ->json_is(q{})
225
      ->json_is(q{})
226
      ->header_like(
226
      ->header_like(
227
          Location => qr|^\/api\/v1\/authorities/\d*|,
227
          Location => qr|^\/api\/v1\/authorities/\d*|,
228
          'SWAGGER3.4.1'
228
          'REST3.4.1'
229
      );
229
      );
230
230
231
    $schema->storage->txn_rollback;
231
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/api/v1/biblios.t (-48 / +55 lines)
Lines 287-294 subtest 'delete() tests' => sub { Link Here
287
287
288
    # Bibs with no items can be deleted
288
    # Bibs with no items can be deleted
289
    $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")
289
    $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")
290
      ->status_is(204, 'SWAGGER3.2.4')
290
      ->status_is(204, 'REST3.2.4')
291
      ->content_is('', 'SWAGGER3.3.4');
291
      ->content_is('', 'REST3.3.4');
292
292
293
    $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")
293
    $t->delete_ok("//$userid:$password@/api/v1/biblios/$biblio_id")
294
      ->status_is(404);
294
      ->status_is(404);
Lines 901-907 subtest 'set_rating() tests' => sub { Link Here
901
901
902
subtest 'add() tests' => sub {
902
subtest 'add() tests' => sub {
903
903
904
    plan tests => 17;
904
    plan tests => 18;
905
905
906
    $schema->storage->txn_begin;
906
    $schema->storage->txn_begin;
907
907
Lines 1312-1320 subtest 'add() tests' => sub { Link Here
1312
    $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode, "x-record-schema" => 'INVALID'})
1312
    $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode, "x-record-schema" => 'INVALID'})
1313
      ->status_is(400, 'Invalid header x-record-schema');
1313
      ->status_is(400, 'Invalid header x-record-schema');
1314
1314
1315
    $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode} => $marcxml)
1315
    $t->post_ok( "//$userid:$password@/api/v1/biblios" =>
1316
      ->status_is(200)
1316
            { 'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode } => $marcxml )
1317
      ->json_has('/id');
1317
        ->status_is(200)
1318
        ->json_has('/id')
1319
        ->header_is( 'Location' => "/api/v1/biblios/" . $t->tx->res->json->{id}, "REST3.4.1" );
1318
1320
1319
    $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marc-in-json', 'x-framework-id' => $frameworkcode, 'x-confirm-not-duplicate' => 1} => $mij)
1321
    $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marc-in-json', 'x-framework-id' => $frameworkcode, 'x-confirm-not-duplicate' => 1} => $mij)
1320
      ->status_is(200)
1322
      ->status_is(200)
Lines 1893-1951 subtest 'list() tests' => sub { Link Here
1893
};
1895
};
1894
1896
1895
subtest 'add_item() tests' => sub {
1897
subtest 'add_item() tests' => sub {
1896
  plan tests => 7;
1897
1898
1898
  $schema->storage->txn_begin;
1899
    plan tests => 8;
1899
1900
1900
  my $patron = $builder->build_object(
1901
    $schema->storage->txn_begin;
1901
      {
1902
          class => 'Koha::Patrons',
1903
          value => { flags => 0 }
1904
      }
1905
  );
1906
  my $password = 'thePassword123';
1907
  $patron->set_password( { password => $password, skip_validation => 1 } );
1908
  my $userid = $patron->userid;
1909
1902
1910
  my $biblio = $builder->build_sample_biblio();
1903
    my $patron = $builder->build_object(
1911
  my $biblio_id = $biblio->biblionumber;
1904
        {
1905
            class => 'Koha::Patrons',
1906
            value => { flags => 0 }
1907
        }
1908
    );
1909
    my $password = 'thePassword123';
1910
    $patron->set_password( { password => $password, skip_validation => 1 } );
1911
    my $userid = $patron->userid;
1912
1912
1913
  my $barcode = 'mybarcode';
1913
    my $biblio    = $builder->build_sample_biblio();
1914
  my $matching_items = Koha::Items->search({ barcode => $barcode });
1914
    my $biblio_id = $biblio->biblionumber;
1915
1915
1916
  while (my $item = $matching_items->next) {
1916
    my $barcode        = 'mybarcode';
1917
    $item->delete;
1917
    my $matching_items = Koha::Items->search( { barcode => $barcode } );
1918
  }
1919
1918
1920
  $t->post_ok("//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => { external_id => $barcode })
1919
    while ( my $item = $matching_items->next ) {
1921
    ->status_is(403, 'Not enough permissions to create an item');
1920
        $item->delete;
1921
    }
1922
1922
1923
  # Add permissions
1923
    $t->post_ok( "//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => { external_id => $barcode } )
1924
  $builder->build(
1924
        ->status_is( 403, 'Not enough permissions to create an item' );
1925
      {
1926
          source => 'UserPermission',
1927
          value  => {
1928
              borrowernumber => $patron->borrowernumber,
1929
              module_bit     => 9,
1930
              code           => 'edit_catalogue'
1931
          }
1932
      }
1933
  );
1934
1925
1935
  $t->post_ok("//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => {
1926
    # Add permissions
1936
      external_id => $barcode,
1927
    $builder->build(
1937
    })
1928
        {
1938
    ->status_is(201, 'Item created')
1929
            source => 'UserPermission',
1939
    ->json_is('/biblio_id', $biblio_id);
1930
            value  => {
1931
                borrowernumber => $patron->borrowernumber,
1932
                module_bit     => 9,
1933
                code           => 'edit_catalogue'
1934
            }
1935
        }
1936
    );
1940
1937
1941
  my $item = $builder->build_sample_item();
1938
    $t->post_ok(
1939
        "//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => {
1940
            external_id => $barcode,
1941
        }
1942
    )->status_is( 201, 'Item created' )->json_is( '/biblio_id', $biblio_id );
1942
1943
1943
  $t->post_ok("//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => {
1944
    my $item_id = $t->tx->res->json->{item_id};
1944
      external_id => $item->barcode,
1945
    $t->header_is( 'Location' => "/api/v1/items/$item_id", "REST3.4.1" );
1945
    })
1946
    ->status_is(409, 'Duplicate barcode');
1947
1946
1948
  $schema->storage->txn_rollback;
1947
    my $item = $builder->build_sample_item();
1948
1949
    $t->post_ok(
1950
        "//$userid:$password@/api/v1/biblios/$biblio_id/items" => json => {
1951
            external_id => $item->barcode,
1952
        }
1953
    )->status_is( 409, 'Duplicate barcode' );
1954
1955
    $schema->storage->txn_rollback;
1949
};
1956
};
1950
1957
1951
subtest 'update_item() tests' => sub {
1958
subtest 'update_item() tests' => sub {
(-)a/t/db_dependent/api/v1/clubs_holds.t (-8 / +10 lines)
Lines 61-67 subtest 'add() tests' => sub { Link Here
61
61
62
    subtest 'librarian access tests' => sub {
62
    subtest 'librarian access tests' => sub {
63
63
64
        plan tests => 20;
64
        plan tests => 21;
65
65
66
        $schema->storage->txn_begin;
66
        $schema->storage->txn_begin;
67
67
Lines 144-156 subtest 'add() tests' => sub { Link Here
144
          ->status_is(409)
144
          ->status_is(409)
145
          ->json_is( '/error' => "Cannot place a hold on a club without patrons." );
145
          ->json_is( '/error' => "Cannot place a hold on a club without patrons." );
146
146
147
        $t->post_ok( "//$userid:$password@/api/v1/clubs/"
147
        $t->post_ok( "//$userid:$password@/api/v1/clubs/" . $club_with_enrollments->id . "/holds" => json => $data )
148
              . $club_with_enrollments->id
148
            ->status_is( 201, 'Created Hold' )
149
              . "/holds" => json => $data )
149
            ->json_has( '/club_hold_id', 'got a club hold id' )
150
          ->status_is( 201, 'Created Hold' )
150
            ->json_is( '/club_id'   => $club_with_enrollments->id )
151
          ->json_has( '/club_hold_id', 'got a club hold id' )
151
            ->json_is( '/biblio_id' => $item->biblionumber )
152
          ->json_is( '/club_id'   => $club_with_enrollments->id )
152
            ->header_is(
153
          ->json_is( '/biblio_id' => $item->biblionumber );
153
            'Location' => '/api/v1/clubs/' . $club_with_enrollments->id . '/holds/' . $t->tx->res->json->{club_hold_id},
154
            'REST3.4.1'
155
            );
154
156
155
        $schema->storage->txn_rollback;
157
        $schema->storage->txn_rollback;
156
    };
158
    };
(-)a/t/db_dependent/api/v1/holds.t (-15 / +16 lines)
Lines 200-206 subtest "Test endpoints without permission" => sub { Link Here
200
200
201
subtest "Test endpoints with permission" => sub {
201
subtest "Test endpoints with permission" => sub {
202
202
203
    plan tests => 44;
203
    plan tests => 45;
204
204
205
    $t->get_ok( "//$userid_1:$password@/api/v1/holds" )
205
    $t->get_ok( "//$userid_1:$password@/api/v1/holds" )
206
      ->status_is(200)
206
      ->status_is(200)
Lines 214-221 subtest "Test endpoints with permission" => sub { Link Here
214
      ->json_hasnt('/1');
214
      ->json_hasnt('/1');
215
215
216
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
216
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
217
      ->status_is(204, 'SWAGGER3.2.4')
217
      ->status_is(204, 'REST3.2.4')
218
      ->content_is('', 'SWAGGER3.3.4');
218
      ->content_is('', 'REST3.3.4');
219
219
220
    $t->patch_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $patch_data )
220
    $t->patch_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $patch_data )
221
      ->status_is(404)
221
      ->status_is(404)
Lines 235-242 subtest "Test endpoints with permission" => sub { Link Here
235
      ->json_is([]);
235
      ->json_is([]);
236
236
237
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" => json => "Cancellation reason" )
237
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" => json => "Cancellation reason" )
238
      ->status_is(204, 'SWAGGER3.2.4')
238
      ->status_is(204, 'REST3.2.4')
239
      ->content_is('', 'SWAGGER3.3.4');
239
      ->content_is('', 'REST3.3.4');
240
240
241
    # Make sure pickup location checks doesn't get in the middle
241
    # Make sure pickup location checks doesn't get in the middle
242
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
242
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
Lines 245-252 subtest "Test endpoints with permission" => sub { Link Here
245
    $mock_item->mock( 'pickup_locations', sub { return Koha::Libraries->search });
245
    $mock_item->mock( 'pickup_locations', sub { return Koha::Libraries->search });
246
246
247
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
247
    $t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data )
248
      ->status_is(201)
248
        ->status_is(201)
249
      ->json_has('/hold_id');
249
        ->json_has('/hold_id')
250
        ->header_is( 'Location' => '/api/v1/holds/' . $t->tx->res->json->{hold_id}, "REST3.4.1" );
250
251
251
    # Get id from response
252
    # Get id from response
252
    $reserve_id = $t->tx->res->json->{hold_id};
253
    $reserve_id = $t->tx->res->json->{hold_id};
Lines 294-301 subtest 'Reserves with itemtype' => sub { Link Here
294
    };
295
    };
295
296
296
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
297
    $t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" )
297
      ->status_is(204, 'SWAGGER3.2.4')
298
      ->status_is(204, 'REST3.2.4')
298
      ->content_is('', 'SWAGGER3.3.4');
299
      ->content_is('', 'REST3.3.4');
299
300
300
    # Make sure pickup location checks doesn't get in the middle
301
    # Make sure pickup location checks doesn't get in the middle
301
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
302
    my $mock_biblio = Test::MockModule->new('Koha::Biblio');
Lines 517-524 subtest 'suspend and resume tests' => sub { Link Here
517
    );
518
    );
518
519
519
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
520
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
520
      ->status_is(204, 'SWAGGER3.2.4')
521
      ->status_is(204, 'REST3.2.4')
521
      ->content_is('', 'SWAGGER3.3.4');
522
      ->content_is('', 'REST3.3.4');
522
523
523
    # Pass a an expiration date for the suspension
524
    # Pass a an expiration date for the suspension
524
    my $date = dt_from_string()->add( days => 5 );
525
    my $date = dt_from_string()->add( days => 5 );
Lines 535-542 subtest 'suspend and resume tests' => sub { Link Here
535
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
536
        ->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' );
536
537
537
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
538
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" )
538
      ->status_is(204, 'SWAGGER3.2.4')
539
      ->status_is(204, 'REST3.2.4')
539
      ->content_is('', 'SWAGGER3.3.4');
540
      ->content_is('', 'REST3.3.4');
540
541
541
    $hold->set_waiting->discard_changes;
542
    $hold->set_waiting->discard_changes;
542
543
Lines 1519-1526 subtest 'delete() tests' => sub { Link Here
1519
        )
1520
        )
1520
    );
1521
    );
1521
1522
1522
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )->status_is( 204, 'SWAGGER3.2.4' )
1523
    $t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )->status_is( 204, 'REST3.2.4' )
1523
        ->content_is( '', 'SWAGGER3.3.4' );
1524
        ->content_is( '', 'REST3.3.4' );
1524
1525
1525
    $hold = Koha::Holds->find(
1526
    $hold = Koha::Holds->find(
1526
        AddReserve(
1527
        AddReserve(
(-)a/t/db_dependent/api/v1/ill_batchstatuses.t (-5 / +8 lines)
Lines 131-137 subtest 'get() tests' => sub { Link Here
131
131
132
subtest 'add() tests' => sub {
132
subtest 'add() tests' => sub {
133
133
134
    plan tests => 14;
134
    plan tests => 15;
135
135
136
    $schema->storage->txn_begin;
136
    $schema->storage->txn_begin;
137
137
Lines 180-189 subtest 'add() tests' => sub { Link Here
180
        );
180
        );
181
181
182
    # Authorized attempt to write
182
    # Authorized attempt to write
183
    my $status_id =
183
    $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata )
184
        $t->post_ok( "//$userid:$password@/api/v1/ill/batchstatuses" => json => $status_metadata )->status_is(201)
184
        ->status_is(201)
185
        ->json_has( '/id',        'ID' )->json_has( '/name', 'Name' )->json_has( '/code', 'Code' )
185
        ->json_has( '/id',        'ID' )
186
        ->json_has( '/is_system', 'is_system' );
186
        ->json_has( '/name',      'Name' )
187
        ->json_has( '/code',      'Code' )
188
        ->json_has( '/is_system', 'is_system' )
189
        ->header_is( 'Location' => '/api/v1/ill/batchstatuses/' . $t->tx->res->json->{code}, "REST3.4.1" );
187
190
188
    # Authorized attempt to create with null id
191
    # Authorized attempt to create with null id
189
    $status_metadata->{id} = undef;
192
    $status_metadata->{id} = undef;
(-)a/t/db_dependent/api/v1/import_batch_profiles.t (-7 / +9 lines)
Lines 110-117 subtest 'list profiles' => sub { Link Here
110
110
111
};
111
};
112
112
113
subtest 'add profile' => sub {
113
subtest 'add() tests' => sub {
114
    plan tests => 5;
114
115
    plan tests => 6;
115
116
116
    $schema->storage->txn_begin;
117
    $schema->storage->txn_begin;
117
118
Lines 140-151 subtest 'add profile' => sub { Link Here
140
        name => 'profileName',
141
        name => 'profileName',
141
        overlay_action => 'overlay_action'
142
        overlay_action => 'overlay_action'
142
    };
143
    };
143
    $t->post_ok("//$uid:$pwd@/api/v1/import_batch_profiles", json => $post_data)
144
      ->status_is(201)
145
      ->json_has('/profile_id')
146
      ->json_is('/name', $post_data->{name})
147
      ->json_is('/overlay_action', $post_data->{overlay_action});
148
144
145
    $t->post_ok( "//$uid:$pwd@/api/v1/import_batch_profiles", json => $post_data )
146
        ->status_is(201)
147
        ->json_has('/profile_id')
148
        ->json_is( '/name',           $post_data->{name} )
149
        ->json_is( '/overlay_action', $post_data->{overlay_action} )
150
        ->header_is( 'Location', '/api/v1/import_batch_profiles/' . $t->tx->res->json->{profile_id}, 'REST3.4.1' );
149
151
150
    $schema->storage->txn_rollback;
152
    $schema->storage->txn_rollback;
151
153
(-)a/t/db_dependent/api/v1/transfer_limits.t (-13 / +13 lines)
Lines 54-60 subtest 'list() tests' => sub { Link Here
54
    my $limit = $builder->build_object({ class => 'Koha::Item::Transfer::Limits' });
54
    my $limit = $builder->build_object({ class => 'Koha::Item::Transfer::Limits' });
55
55
56
    $t->get_ok( "//$userid:$password@/api/v1/transfer_limits" )
56
    $t->get_ok( "//$userid:$password@/api/v1/transfer_limits" )
57
      ->status_is( 200, 'SWAGGER3.2.2' )
57
      ->status_is( 200, 'REST3.2.2' )
58
      ->json_is( [$limit->to_api] );
58
      ->json_is( [$limit->to_api] );
59
59
60
    $schema->storage->txn_rollback;
60
    $schema->storage->txn_rollback;
Lines 62-68 subtest 'list() tests' => sub { Link Here
62
62
63
subtest 'add() tests' => sub {
63
subtest 'add() tests' => sub {
64
64
65
    plan tests => 11;
65
    plan tests => 12;
66
66
67
    $schema->storage->txn_begin;
67
    $schema->storage->txn_begin;
68
68
Lines 106-113 subtest 'add() tests' => sub { Link Here
106
106
107
    # Authorized attempt to write
107
    # Authorized attempt to write
108
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref )
108
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref )
109
      ->status_is( 201, 'SWAGGER3.2.1' )
109
        ->status_is( 201, 'REST3.2.1' )
110
      ->json_has( '' => $limit_hashref, 'SWAGGER3.3.1' );
110
        ->json_has( '' => $limit_hashref, 'REST3.3.1' )
111
        ->header_is( 'Location' => '/api/v1/transfer_limits/' . $t->tx->res->json->{limit_id}, 'REST3.4.1' );
111
112
112
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref )
113
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits" => json => $limit_hashref )
113
      ->status_is( 409, 'Conflict creating the resource' )
114
      ->status_is( 409, 'Conflict creating the resource' )
Lines 148-155 subtest 'delete() tests' => sub { Link Here
148
      ->status_is(403);
149
      ->status_is(403);
149
150
150
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/$limit_id" )
151
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/$limit_id" )
151
      ->status_is(204, 'SWAGGER3.2.4')
152
      ->status_is(204, 'REST3.2.4')
152
      ->content_is('', 'SWAGGER3.3.4');
153
      ->content_is('', 'REST3.3.4');
153
154
154
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/$limit_id" )
155
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/$limit_id" )
155
      ->status_is(404);
156
      ->status_is(404);
Lines 228-234 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
228
229
229
    # Create all combinations of to/from libraries
230
    # Create all combinations of to/from libraries
230
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
231
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
231
        ->status_is( 201, 'SWAGGER3.2.1' )->json_has( '' => $limit_hashref, 'SWAGGER3.3.1' );
232
        ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' );
232
233
233
    my $limits = Koha::Item::Transfer::Limits->search;
234
    my $limits = Koha::Item::Transfer::Limits->search;
234
235
Lines 237-243 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
237
238
238
    # Delete all combinations of to/from libraries
239
    # Delete all combinations of to/from libraries
239
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
240
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
240
        ->status_is( 204, 'SWAGGER3.2.4' )->content_is( '', 'SWAGGER3.3.4' );
241
        ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' );
241
242
242
    $limits = Koha::Item::Transfer::Limits->search;
243
    $limits = Koha::Item::Transfer::Limits->search;
243
244
Lines 246-252 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
246
    # Create all combinations of 'to' libraries
247
    # Create all combinations of 'to' libraries
247
    $limit_hashref->{to_library_id} = $library->id;
248
    $limit_hashref->{to_library_id} = $library->id;
248
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
249
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
249
        ->status_is( 201, 'SWAGGER3.2.1' )->json_has( '' => $limit_hashref, 'SWAGGER3.3.1' );
250
        ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' );
250
251
251
    $limits = Koha::Item::Transfer::Limits->search;
252
    $limits = Koha::Item::Transfer::Limits->search;
252
253
Lines 254-260 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
254
255
255
    # Delete all combinations of 'to' libraries
256
    # Delete all combinations of 'to' libraries
256
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
257
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
257
        ->status_is( 204, 'SWAGGER3.2.4' )->content_is( '', 'SWAGGER3.3.4' );
258
        ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' );
258
259
259
    $limits = Koha::Item::Transfer::Limits->search;
260
    $limits = Koha::Item::Transfer::Limits->search;
260
261
Lines 266-272 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
266
    delete $limit_hashref->{to_library_id};
267
    delete $limit_hashref->{to_library_id};
267
    $limit_hashref->{from_library_id} = $library->id;
268
    $limit_hashref->{from_library_id} = $library->id;
268
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
269
    $t->post_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
269
        ->status_is( 201, 'SWAGGER3.2.1' )->json_has( '' => $limit_hashref, 'SWAGGER3.3.1' );
270
        ->status_is( 201, 'REST3.2.1' )->json_has( '' => $limit_hashref, 'REST3.3.1' );
270
271
271
    $limits = Koha::Item::Transfer::Limits->search;
272
    $limits = Koha::Item::Transfer::Limits->search;
272
273
Lines 275-281 subtest 'batch_add() and batch_delete() tests' => sub { Link Here
275
276
276
    # Delete all combinations of 'from' libraries
277
    # Delete all combinations of 'from' libraries
277
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
278
    $t->delete_ok( "//$auth_userid:$password@/api/v1/transfer_limits/batch" => json => $limit_hashref )
278
        ->status_is( 204, 'SWAGGER3.2.4' )->content_is( '', 'SWAGGER3.3.4' );
279
        ->status_is( 204, 'REST3.2.4' )->content_is( '', 'REST3.3.4' );
279
280
280
    $limits = Koha::Item::Transfer::Limits->search;
281
    $limits = Koha::Item::Transfer::Limits->search;
281
282
282
- 

Return to bug 38929