Fixing UT for key_type on upload schema

This commit is contained in:
sayali 2020-09-28 19:03:21 -07:00
parent 7a226241db
commit aaff0f7581
2 changed files with 8 additions and 1 deletions

View File

@ -376,7 +376,13 @@ class CertificateUploadInputSchema(CertificateCreationSchema):
@pre_load
def load_data(self, data):
if data.get("body"):
try:
data["key_type"] = utils.get_key_type_from_certificate(data["body"])
except ValueError:
raise ValidationError(
"Public certificate presented is not valid.", field_names=["body"]
)
class CertificateExportInputSchema(LemurInputSchema):

View File

@ -55,6 +55,7 @@ def test_create_pending(pending_certificate, user, session):
assert real_cert.notify == pending_certificate.notify
assert real_cert.private_key == pending_certificate.private_key
assert real_cert.external_id == "54321"
assert real_cert.key_type == "RSA2048"
@pytest.mark.parametrize(