Return 'already deleted' instead of 'not found' when cert has already been deleted
This commit is contained in:
parent
a9735e129c
commit
63de8047ce
|
@ -691,9 +691,12 @@ class Certificates(AuthenticatedResource):
|
|||
|
||||
cert = service.get(certificate_id)
|
||||
|
||||
if not cert or cert.deleted:
|
||||
if not cert:
|
||||
return dict(message="Cannot find specified certificate"), 404
|
||||
|
||||
if cert.deleted:
|
||||
return dict(message="Certificate is already deleted"), 412
|
||||
|
||||
# allow creators
|
||||
if g.current_user != cert.user:
|
||||
owner_role = role_service.get_by_name(cert.owner)
|
||||
|
|
|
@ -738,7 +738,7 @@ def test_certificate_put_with_data(client, certificate, issuer_plugin):
|
|||
@pytest.mark.parametrize("token,status", [
|
||||
(VALID_USER_HEADER_TOKEN, 403),
|
||||
(VALID_ADMIN_HEADER_TOKEN, 204),
|
||||
(VALID_ADMIN_API_TOKEN, 404),
|
||||
(VALID_ADMIN_API_TOKEN, 412),
|
||||
('', 401)
|
||||
])
|
||||
def test_certificate_delete(client, token, status):
|
||||
|
|
Loading…
Reference in New Issue