Bug 37672: Add tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomás Cohen Arazi 2024-08-19 09:55:06 -03:00 committed by Katrin Fischer
parent e6ef792e10
commit 765c724f98
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -136,7 +136,7 @@ subtest 'get() tests' => sub {
subtest 'delete() tests' => sub {
plan tests => 6;
plan tests => 10;
$schema->storage->txn_begin;
@ -168,7 +168,15 @@ subtest 'delete() tests' => sub {
$patron->set_password( { password => $password, skip_validation => 1 } );
$userid = $patron->userid;
$t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 204, 'SWAGGER3.2.2' );
$source->delete();
$t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 404, 'REST4.3' )
->json_is( { error => q{Record source not found}, error_code => q{not_found} } );
$source = $builder->build_object( { class => 'Koha::RecordSources' } );
$id = $source->id;
$t->delete_ok("//$userid:$password@/api/v1/record_sources/$id")->status_is( 204, 'REST3.2.4' )
->content_is( q{}, 'REST3.3.4' );
my $deleted_source = Koha::RecordSources->search( { record_source_id => $id } );