From 25340fd744a239d48df18cb0f60de25cf3af4acc Mon Sep 17 00:00:00 2001 From: Neil Schelly Date: Wed, 18 Jan 2017 17:16:19 -0500 Subject: [PATCH] Combining Authority Key Identifier extension options in the schema. (#651) * Combining Authority Key Identifier extension options in the schema. This makes processing them in the cert/csr generation stage make more sense because they are two options in the same x.509 extension. They were already in the same part of the schema for authorities, but this makes the certificates follow the same pattern, and it allows them to share the same schema/validation layout. * Updating schema tests to match changes * Fixing an idiot typo * I promise to stop using Travis as a typo-corrector soon. --- lemur/schemas.py | 6 +---- .../certificates/certificate/options.tpl.html | 6 ++--- lemur/tests/test_certificates.py | 24 +++++++------------ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/lemur/schemas.py b/lemur/schemas.py index 4574a5a0..a9e91e2b 100644 --- a/lemur/schemas.py +++ b/lemur/schemas.py @@ -170,12 +170,9 @@ class BasicConstraintsSchema(BaseExtensionSchema): pass -class AuthorityIdentifierSchema(BaseExtensionSchema): - use_authority_cert = fields.Boolean() - - class AuthorityKeyIdentifierSchema(BaseExtensionSchema): use_key_identifier = fields.Boolean() + use_authority_cert = fields.Boolean() class CertificateInfoAccessSchema(BaseExtensionSchema): @@ -240,7 +237,6 @@ class ExtensionSchema(BaseExtensionSchema): extended_key_usage = fields.Nested(ExtendedKeyUsageSchema) subject_key_identifier = fields.Nested(SubjectKeyIdentifierSchema) sub_alt_names = fields.Nested(SubAltNamesSchema) - authority_identifier = fields.Nested(AuthorityIdentifierSchema) authority_key_identifier = fields.Nested(AuthorityKeyIdentifierSchema) certificate_info_access = fields.Nested(CertificateInfoAccessSchema) custom = fields.List(fields.Nested(CustomOIDSchema)) diff --git a/lemur/static/app/angular/certificates/certificate/options.tpl.html b/lemur/static/app/angular/certificates/certificate/options.tpl.html index e0da155e..c38eb863 100644 --- a/lemur/static/app/angular/certificates/certificate/options.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/options.tpl.html @@ -184,15 +184,13 @@
diff --git a/lemur/tests/test_certificates.py b/lemur/tests/test_certificates.py index cf9b01ec..25fc9b31 100644 --- a/lemur/tests/test_certificates.py +++ b/lemur/tests/test_certificates.py @@ -65,27 +65,19 @@ def test_certificate_edit_schema(session): assert len(data['notifications']) == 3 -def test_authority_identifier_schema(): - from lemur.schemas import AuthorityIdentifierSchema - input_data = {'useAuthorityCert': True} - - data, errors = AuthorityIdentifierSchema().load(input_data) - - assert data == {'use_authority_cert': True} - assert not errors - - data, errors = AuthorityIdentifierSchema().dumps(data) - assert not errors - assert data == json.dumps(input_data) - - def test_authority_key_identifier_schema(): from lemur.schemas import AuthorityKeyIdentifierSchema - input_data = {'useKeyIdentifier': True} + input_data = { + 'useKeyIdentifier': True, + 'useAuthorityCert': True + } data, errors = AuthorityKeyIdentifierSchema().load(input_data) - assert data == {'use_key_identifier': True} + assert data == { + 'use_key_identifier': True, + 'use_authority_cert': True + } assert not errors data, errors = AuthorityKeyIdentifierSchema().dumps(data)