From f739e646ac451895d3e59e120d079e5add3b8d73 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 1 Nov 2023 15:45:36 -0300 Subject: [PATCH] Bug 26170: API behavior change tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/api/v1/patrons.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index 04060d46a2..f882cae0e0 100755 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -832,7 +832,8 @@ subtest 'delete() tests' => sub { $schema->storage->txn_rollback; subtest 'librarian access test' => sub { - plan tests => 18; + + plan tests => 21; $schema->storage->txn_begin; @@ -912,6 +913,18 @@ subtest 'delete() tests' => sub { # Remove guarantee $patron->guarantee_relationships->delete; + $patron->protected(1)->store(); + + $t->delete_ok( "//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber ) + ->status_is( 409, 'Protected patron cannot be deleted' )->json_is( + { + error => 'Protected patrons cannot be deleted', + error_code => 'is_protected' + } + ); + + $patron->protected(0)->store(); + $t->delete_ok("//$userid:$password@/api/v1/patrons/" . $patron->borrowernumber) ->status_is(204, 'SWAGGER3.2.4') ->content_is('', 'SWAGGER3.3.4'); -- 2.39.2