From 59f018da852259989f9a01a432babdabcbf42234 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 19 Aug 2024 09:55:06 -0300 Subject: [PATCH] Bug 37672: Add tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/api/v1/record_sources.t | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/api/v1/record_sources.t b/t/db_dependent/api/v1/record_sources.t index 09f3578375f..0fb37a90919 100755 --- a/t/db_dependent/api/v1/record_sources.t +++ b/t/db_dependent/api/v1/record_sources.t @@ -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 } ); -- 2.46.0