format DeletionDate properly for JSON serialization

This commit is contained in:
Jon Beilke 2018-10-05 22:46:19 -05:00
parent 786b9ca519
commit 372f749831

View File

@ -9,6 +9,7 @@ from boto.exception import JSONResponseError
from boto.kms.exceptions import AlreadyExistsException, NotFoundException
from moto.core.responses import BaseResponse
from moto.core.utils import iso_8601_datetime_without_milliseconds
from .models import kms_backends
reserved_aliases = [
@ -272,7 +273,7 @@ class KmsResponse(BaseResponse):
try:
return json.dumps({
'KeyId': key_id,
'DeletionDate': self.kms_backend.schedule_key_deletion(key_id)
'DeletionDate': iso_8601_datetime_without_milliseconds(self.kms_backend.schedule_key_deletion(key_id))
})
except KeyError:
raise JSONResponseError(404, 'Not Found', body={