Lines 899-907
subtest 'set_rating() tests' => sub {
Link Here
|
899 |
}; |
899 |
}; |
900 |
|
900 |
|
901 |
|
901 |
|
902 |
subtest 'post() tests' => sub { |
902 |
subtest 'add() tests' => sub { |
903 |
|
903 |
|
904 |
plan tests => 14; |
904 |
plan tests => 17; |
905 |
|
905 |
|
906 |
$schema->storage->txn_begin; |
906 |
$schema->storage->txn_begin; |
907 |
|
907 |
|
Lines 1358-1363
subtest 'post() tests' => sub {
Link Here
|
1358 |
)->status_is(200); |
1358 |
)->status_is(200); |
1359 |
}; |
1359 |
}; |
1360 |
|
1360 |
|
|
|
1361 |
my $mock_biblio = Test::MockModule->new('C4::Biblio'); |
1362 |
|
1363 |
# FIXME: AddBiblio wraps everything inside a transaction and a try/catch block |
1364 |
# this will need a tweak if this behavior changes |
1365 |
$mock_biblio->mock( 'AddBiblio', sub { return ( undef, undef ); } ); |
1366 |
|
1367 |
$t->post_ok( "//$userid:$password@/api/v1/biblios" => |
1368 |
{ 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc ) |
1369 |
->status_is(400) |
1370 |
->json_is( |
1371 |
{ |
1372 |
error => 'Error creating record', |
1373 |
error_code => 'record_creation_failed' |
1374 |
} |
1375 |
); |
1376 |
|
1361 |
$schema->storage->txn_rollback; |
1377 |
$schema->storage->txn_rollback; |
1362 |
}; |
1378 |
}; |
1363 |
|
1379 |
|
1364 |
- |
|
|