Convert fields createdAt and updatedAt of deployment to timestamp
This commit is contained in:
parent
9b535a7c75
commit
3c19f0a02d
@ -8,6 +8,7 @@ import boto3
|
||||
import pytz
|
||||
from moto.core.exceptions import JsonRESTError
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core.utils import unix_time
|
||||
from moto.ec2 import ec2_backends
|
||||
from copy import copy
|
||||
|
||||
@ -231,9 +232,9 @@ class Service(BaseObject):
|
||||
|
||||
for deployment in response_object['deployments']:
|
||||
if isinstance(deployment['createdAt'], datetime):
|
||||
deployment['createdAt'] = deployment['createdAt'].isoformat()
|
||||
deployment['createdAt'] = unix_time(deployment['createdAt'].replace(tzinfo=None))
|
||||
if isinstance(deployment['updatedAt'], datetime):
|
||||
deployment['updatedAt'] = deployment['updatedAt'].isoformat()
|
||||
deployment['updatedAt'] = unix_time(deployment['updatedAt'].replace(tzinfo=None))
|
||||
|
||||
return response_object
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
from datetime import datetime
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
@ -477,6 +478,8 @@ def test_describe_services():
|
||||
response['services'][0]['deployments'][0]['pendingCount'].should.equal(2)
|
||||
response['services'][0]['deployments'][0]['runningCount'].should.equal(0)
|
||||
response['services'][0]['deployments'][0]['status'].should.equal('PRIMARY')
|
||||
(datetime.now() - response['services'][0]['deployments'][0]["createdAt"].replace(tzinfo=None)).seconds.should.be.within(0, 10)
|
||||
(datetime.now() - response['services'][0]['deployments'][0]["updatedAt"].replace(tzinfo=None)).seconds.should.be.within(0, 10)
|
||||
|
||||
|
||||
@mock_ecs
|
||||
|
Loading…
Reference in New Issue
Block a user