Lines 254-260
subtest 'update() tests' => sub {
Link Here
|
254 |
$schema->storage->txn_rollback; |
254 |
$schema->storage->txn_rollback; |
255 |
|
255 |
|
256 |
subtest 'librarian access tests' => sub { |
256 |
subtest 'librarian access tests' => sub { |
257 |
plan tests => 23; |
257 |
plan tests => 22; |
258 |
|
258 |
|
259 |
$schema->storage->txn_begin; |
259 |
$schema->storage->txn_begin; |
260 |
|
260 |
|
Lines 284-294
subtest 'update() tests' => sub {
Link Here
|
284 |
$newpatron->{category_id} = $deleted_category_id; |
284 |
$newpatron->{category_id} = $deleted_category_id; |
285 |
$tx = $t->ua->build_tx(PUT => "/api/v1/patrons/$patron_id_2" => json => $newpatron ); |
285 |
$tx = $t->ua->build_tx(PUT => "/api/v1/patrons/$patron_id_2" => json => $newpatron ); |
286 |
$tx->req->cookies({name => 'CGISESSID', value => $session_id}); |
286 |
$tx->req->cookies({name => 'CGISESSID', value => $session_id}); |
287 |
warning_like { |
287 |
$t->request_ok($tx) |
288 |
$t->request_ok($tx) |
288 |
->status_is(400) |
289 |
->status_is(400) |
289 |
->json_is('/error' => "Given category_id does not exist"); |
290 |
->json_is('/error' => "Given category_id does not exist"); } |
|
|
291 |
qr/^DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails/; |
292 |
$newpatron->{category_id} = $patron_2->categorycode; |
290 |
$newpatron->{category_id} = $patron_2->categorycode; |
293 |
|
291 |
|
294 |
# Create a library just to make sure its ID doesn't exist on the DB |
292 |
# Create a library just to make sure its ID doesn't exist on the DB |
295 |
- |
|
|