mirror of
https://github.com/laurivosandi/certidude
synced 2024-12-22 16:25:17 +00:00
tests: Attempt to catch CRL export errors
This commit is contained in:
parent
e228963bd2
commit
ffdcbcc41a
@ -37,7 +37,11 @@ class RevocationListResource(object):
|
|||||||
"Content-Disposition",
|
"Content-Disposition",
|
||||||
("attachment; filename=%s-crl.pem" % const.HOSTNAME).encode("ascii"))
|
("attachment; filename=%s-crl.pem" % const.HOSTNAME).encode("ascii"))
|
||||||
logger.debug(u"Serving revocation list to %s in PEM format", req.context.get("remote_addr"))
|
logger.debug(u"Serving revocation list to %s in PEM format", req.context.get("remote_addr"))
|
||||||
resp.body = export_crl()
|
try:
|
||||||
|
resp.body = export_crl()
|
||||||
|
except:
|
||||||
|
logger.debug(u"Failed to export CRL, are you sure signer is running?")
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
logger.debug(u"Client %s asked revocation list in unsupported format" % req.context.get("remote_addr"))
|
logger.debug(u"Client %s asked revocation list in unsupported format" % req.context.get("remote_addr"))
|
||||||
raise falcon.HTTPUnsupportedMediaType(
|
raise falcon.HTTPUnsupportedMediaType(
|
||||||
|
@ -199,14 +199,6 @@ def test_cli_setup_authority():
|
|||||||
assert r.status_code == 415
|
assert r.status_code == 415
|
||||||
|
|
||||||
# Test revocations API call
|
# Test revocations API call
|
||||||
r = client().simulate_get("/api/revoked/")
|
|
||||||
assert r.status_code == 200
|
|
||||||
assert r.headers.get('content-type') == "application/x-pkcs7-crl"
|
|
||||||
|
|
||||||
r = requests.get("http://ca.example.lan/api/revoked/")
|
|
||||||
assert r.status_code == 200
|
|
||||||
assert r.headers.get('content-type') == "application/x-pkcs7-crl"
|
|
||||||
|
|
||||||
r = client().simulate_get("/api/revoked/",
|
r = client().simulate_get("/api/revoked/",
|
||||||
headers={"Accept":"application/x-pem-file"})
|
headers={"Accept":"application/x-pem-file"})
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
@ -217,6 +209,14 @@ def test_cli_setup_authority():
|
|||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert r.headers.get('content-type') == "application/x-pem-file"
|
assert r.headers.get('content-type') == "application/x-pem-file"
|
||||||
|
|
||||||
|
r = client().simulate_get("/api/revoked/")
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert r.headers.get('content-type') == "application/x-pkcs7-crl"
|
||||||
|
|
||||||
|
r = requests.get("http://ca.example.lan/api/revoked/")
|
||||||
|
assert r.status_code == 200
|
||||||
|
assert r.headers.get('content-type') == "application/x-pkcs7-crl"
|
||||||
|
|
||||||
r = client().simulate_get("/api/revoked/",
|
r = client().simulate_get("/api/revoked/",
|
||||||
headers={"Accept":"text/plain"})
|
headers={"Accept":"text/plain"})
|
||||||
assert r.status_code == 415
|
assert r.status_code == 415
|
||||||
|
Loading…
Reference in New Issue
Block a user