Lines 207-214
subtest 'add() tests' => sub {
Link Here
|
207 |
$t->post_ok("//$userid:$password@/api/v1/patrons" => json => $newpatron) |
207 |
$t->post_ok("//$userid:$password@/api/v1/patrons" => json => $newpatron) |
208 |
->status_is(409) |
208 |
->status_is(409) |
209 |
->json_has( '/error', 'Fails when trying to POST duplicate cardnumber' ) |
209 |
->json_has( '/error', 'Fails when trying to POST duplicate cardnumber' ) |
210 |
->json_has( '/conflict', 'cardnumber' ); } |
210 |
->json_like( '/conflict' => qr/(borrowers\.)?cardnumber/ ); } |
211 |
qr/^DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key 'cardnumber'/; |
211 |
qr/^DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key '(borrowers\.)?cardnumber'/; |
212 |
|
212 |
|
213 |
$schema->storage->txn_rollback; |
213 |
$schema->storage->txn_rollback; |
214 |
}; |
214 |
}; |
Lines 311-318
subtest 'update() tests' => sub {
Link Here
|
311 |
$t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) |
311 |
$t->put_ok( "//$userid:$password@/api/v1/patrons/" . $patron_2->borrowernumber => json => $newpatron ) |
312 |
->status_is(409) |
312 |
->status_is(409) |
313 |
->json_has( '/error' => "Fails when trying to update to an existing cardnumber or userid") |
313 |
->json_has( '/error' => "Fails when trying to update to an existing cardnumber or userid") |
314 |
->json_is( '/conflict', 'cardnumber' ); } |
314 |
->json_like( '/conflict' => qr/(borrowers\.)?cardnumber/ ); } |
315 |
qr/^DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key 'cardnumber'/; |
315 |
qr/^DBD::mysql::st execute failed: Duplicate entry '(.*?)' for key '(borrowers\.)?cardnumber'/; |
316 |
|
316 |
|
317 |
$newpatron->{ cardnumber } = $patron_1->id . $patron_2->id; |
317 |
$newpatron->{ cardnumber } = $patron_1->id . $patron_2->id; |
318 |
$newpatron->{ userid } = "user" . $patron_1->id.$patron_2->id; |
318 |
$newpatron->{ userid } = "user" . $patron_1->id.$patron_2->id; |
319 |
- |
|
|