Hexify cert serial (#763)

* Hexify serial at the serialization layer

* Fix for flakey test. Change test to test for uppercased string
This commit is contained in:
Michael Treacher
2017-04-28 02:13:04 +10:00
committed by kevgliss
parent 88ac783fd2
commit 05f4ae8e58
2 changed files with 15 additions and 4 deletions

View File

@ -6,7 +6,7 @@
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from flask import current_app
from marshmallow import fields, validate, validates_schema, post_load, pre_load
from marshmallow import fields, validate, validates_schema, post_load, pre_load, post_dump
from marshmallow.exceptions import ValidationError
from lemur.schemas import AssociatedAuthoritySchema, AssociatedDestinationSchema, AssociatedCertificateSchema, \
@ -198,6 +198,12 @@ class CertificateOutputSchema(LemurOutputSchema):
endpoints = fields.Nested(EndpointNestedOutputSchema, many=True, missing=[])
replaced_by = fields.Nested(CertificateNestedOutputSchema, many=True, attribute='replaced')
@post_dump
def convert_serial_to_hex(self, data):
if data:
data['serial'] = hex(int(data['serial']))[2:].upper()
return data
class CertificateUploadInputSchema(CertificateCreationSchema):
name = fields.String()