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 |
- |
|
|