certificate sign with a non-existing cert should throw HTTP 400
Add throw exception for the validate code of CSR. Then it will throw HTTP 400 when the CSR validation is not passed. Change-Id: I6603a2a243097687fef8666343b993c0a18946a9 Closes-Bug: #1543643
This commit is contained in:
parent
2c80ebe76c
commit
58b61fa26e
|
@ -202,8 +202,8 @@ class BayTest(base.BaseMagnumTest):
|
|||
|
||||
# test ca sign invalid
|
||||
model = datagen.cert_data(bay_uuid=bay_model.uuid,
|
||||
csr_data="invalid_path")
|
||||
csr_data="invalid_csr")
|
||||
self.assertRaises(
|
||||
exceptions.ServerFault,
|
||||
exceptions.BadRequest,
|
||||
self.cert_client.post_cert,
|
||||
model)
|
||||
|
|
|
@ -295,6 +295,8 @@ def cert_data(bay_uuid, csr_data=None):
|
|||
if csr_data is not None and os.path.isfile(csr_data):
|
||||
with open(csr_data, 'r') as f:
|
||||
data['csr'] = f.read()
|
||||
else:
|
||||
data['csr'] = csr_data
|
||||
|
||||
model = cert_model.CertEntity.from_dict(data)
|
||||
|
||||
|
|
Loading…
Reference in New Issue