Bug 27330: (QA follow-up) Return 409 instead

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fd27224415)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit fd75ab1808)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2021-01-27 07:37:05 -03:00 committed by Andrew Fuerste-Henry
parent 5e4edb2b09
commit fef046d851
3 changed files with 9 additions and 3 deletions

View File

@ -132,7 +132,7 @@ sub add {
if ( blessed $_ ) {
if ($_->isa('Koha::Exceptions::ClubHold::NoPatrons')) {
return $c->render(
status => 403,
status => 409,
openapi => { error => $_->description }
);
}

View File

@ -81,6 +81,12 @@
"$ref": "../definitions.json#/error"
}
},
"409": {
"description": "Hold not allowed",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
@ -101,4 +107,4 @@
}
}
}
}
}

View File

@ -86,7 +86,7 @@ subtest 'add() tests' => sub {
$t->post_ok( "//$userid:$password@/api/v1/clubs/"
. $club_without_enrollments->id
. "/holds" => json => $data )
->status_is(403)
->status_is(409)
->json_is( '/error' => "Cannot place a hold on a club without patrons." );
$t->post_ok( "//$userid:$password@/api/v1/clubs/"