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

(-)a/t/db_dependent/api/v1/acquisitions_orders.t (-2 / +2 lines)
Lines 211-218 subtest 'add() tests' => sub { Link Here
211
        $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order )
211
        $t->post_ok( "//$auth_userid:$password@/api/v1/acquisitions/orders" => json => $order )
212
          ->status_is(409)
212
          ->status_is(409)
213
          ->json_has( '/error' => "Fails when trying to add an existing order_id")
213
          ->json_has( '/error' => "Fails when trying to add an existing order_id")
214
          ->json_is(  '/conflict', 'PRIMARY' ); } # WTF
214
          ->json_like( '/conflict' => qr/(aqorders\.)?PRIMARY/ ); }
215
        qr/^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key 'PRIMARY'/;
215
        qr/^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(aqorders\.)?PRIMARY'/;
216
216
217
    $schema->storage->txn_rollback;
217
    $schema->storage->txn_rollback;
218
};
218
};
(-)a/t/db_dependent/api/v1/libraries.t (-2 / +2 lines)
Lines 199-206 subtest 'add() tests' => sub { Link Here
199
        $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library )
199
        $t->post_ok( "//$auth_userid:$password@/api/v1/libraries" => json => $library )
200
          ->status_is(409)
200
          ->status_is(409)
201
          ->json_has( '/error' => "Fails when trying to add an existing library_id")
201
          ->json_has( '/error' => "Fails when trying to add an existing library_id")
202
          ->json_is(  '/conflict', 'PRIMARY' ); } # WTF
202
          ->json_like( '/conflict' => qr/(branches\.)?PRIMARY/ ); }
203
        qr/^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key 'PRIMARY'/;
203
        qr/^DBD::mysql::st execute failed: Duplicate entry '(.*)' for key '(branches\.)?PRIMARY'/;
204
204
205
    $schema->storage->txn_rollback;
205
    $schema->storage->txn_rollback;
206
};
206
};
(-)a/t/db_dependent/api/v1/patrons.t (-5 / +4 lines)
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
- 

Return to bug 24509