Merge pull request #693 from swipetospin/master
ALWAYS use utcnow(), never now()
This commit is contained in:
commit
59be70d0e4
@ -27,8 +27,8 @@ class FakeAlarm(object):
|
|||||||
self.ok_actions = ok_actions
|
self.ok_actions = ok_actions
|
||||||
self.insufficient_data_actions = insufficient_data_actions
|
self.insufficient_data_actions = insufficient_data_actions
|
||||||
self.unit = unit
|
self.unit = unit
|
||||||
self.state_updated_timestamp = datetime.datetime.now()
|
self.state_updated_timestamp = datetime.datetime.utcnow()
|
||||||
self.configuration_updated_timestamp = datetime.datetime.now()
|
self.configuration_updated_timestamp = datetime.datetime.utcnow()
|
||||||
|
|
||||||
|
|
||||||
class MetricDatum(object):
|
class MetricDatum(object):
|
||||||
|
@ -269,7 +269,7 @@ def metadata_response(request, full_url, headers):
|
|||||||
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html
|
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html
|
||||||
"""
|
"""
|
||||||
parsed_url = urlparse(full_url)
|
parsed_url = urlparse(full_url)
|
||||||
tomorrow = datetime.datetime.now() + datetime.timedelta(days=1)
|
tomorrow = datetime.datetime.utcnow() + datetime.timedelta(days=1)
|
||||||
credentials = dict(
|
credentials = dict(
|
||||||
AccessKeyId="test-key",
|
AccessKeyId="test-key",
|
||||||
SecretAccessKey="test-secret-key",
|
SecretAccessKey="test-secret-key",
|
||||||
|
@ -100,7 +100,7 @@ class Table(object):
|
|||||||
self.range_key_type = range_key_type
|
self.range_key_type = range_key_type
|
||||||
self.read_capacity = read_capacity
|
self.read_capacity = read_capacity
|
||||||
self.write_capacity = write_capacity
|
self.write_capacity = write_capacity
|
||||||
self.created_at = datetime.datetime.now()
|
self.created_at = datetime.datetime.utcnow()
|
||||||
self.items = defaultdict(dict)
|
self.items = defaultdict(dict)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -189,7 +189,7 @@ class Table(object):
|
|||||||
self.throughput["NumberOfDecreasesToday"] = 0
|
self.throughput["NumberOfDecreasesToday"] = 0
|
||||||
self.indexes = indexes
|
self.indexes = indexes
|
||||||
self.global_indexes = global_indexes if global_indexes else []
|
self.global_indexes = global_indexes if global_indexes else []
|
||||||
self.created_at = datetime.datetime.now()
|
self.created_at = datetime.datetime.utcnow()
|
||||||
self.items = defaultdict(dict)
|
self.items = defaultdict(dict)
|
||||||
|
|
||||||
def describe(self, base_key='TableDescription'):
|
def describe(self, base_key='TableDescription'):
|
||||||
|
@ -50,7 +50,7 @@ class Database(object):
|
|||||||
self.availability_zone = kwargs.get("availability_zone")
|
self.availability_zone = kwargs.get("availability_zone")
|
||||||
self.multi_az = kwargs.get("multi_az")
|
self.multi_az = kwargs.get("multi_az")
|
||||||
self.db_subnet_group_name = kwargs.get("db_subnet_group_name")
|
self.db_subnet_group_name = kwargs.get("db_subnet_group_name")
|
||||||
self.instance_create_time = str(datetime.datetime.now())
|
self.instance_create_time = str(datetime.datetime.utcnow())
|
||||||
if self.db_subnet_group_name:
|
if self.db_subnet_group_name:
|
||||||
self.db_subnet_group = rds_backends[self.region].describe_subnet_groups(self.db_subnet_group_name)[0]
|
self.db_subnet_group = rds_backends[self.region].describe_subnet_groups(self.db_subnet_group_name)[0]
|
||||||
else:
|
else:
|
||||||
|
@ -87,7 +87,7 @@ class Subscription(object):
|
|||||||
"TopicArn": self.topic.arn,
|
"TopicArn": self.topic.arn,
|
||||||
"Subject": "my subject",
|
"Subject": "my subject",
|
||||||
"Message": message,
|
"Message": message,
|
||||||
"Timestamp": iso_8601_datetime_with_milliseconds(datetime.datetime.now()),
|
"Timestamp": iso_8601_datetime_with_milliseconds(datetime.datetime.utcnow()),
|
||||||
"SignatureVersion": "1",
|
"SignatureVersion": "1",
|
||||||
"Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",
|
"Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",
|
||||||
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
|
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
|
||||||
|
@ -6,7 +6,7 @@ from moto.core.utils import iso_8601_datetime_with_milliseconds
|
|||||||
|
|
||||||
class Token(object):
|
class Token(object):
|
||||||
def __init__(self, duration, name=None, policy=None):
|
def __init__(self, duration, name=None, policy=None):
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.utcnow()
|
||||||
self.expiration = now + datetime.timedelta(seconds=duration)
|
self.expiration = now + datetime.timedelta(seconds=duration)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.policy = None
|
self.policy = None
|
||||||
@ -21,7 +21,7 @@ class AssumedRole(object):
|
|||||||
self.session_name = role_session_name
|
self.session_name = role_session_name
|
||||||
self.arn = role_arn
|
self.arn = role_arn
|
||||||
self.policy = policy
|
self.policy = policy
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.utcnow()
|
||||||
self.expiration = now + datetime.timedelta(seconds=duration)
|
self.expiration = now + datetime.timedelta(seconds=duration)
|
||||||
self.external_id = external_id
|
self.external_id = external_id
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ def test_list_open_workflow_executions():
|
|||||||
reason='a more complete reason',
|
reason='a more complete reason',
|
||||||
run_id=run_id)
|
run_id=run_id)
|
||||||
|
|
||||||
yesterday = datetime.now() - timedelta(days=1)
|
yesterday = datetime.utcnow() - timedelta(days=1)
|
||||||
oldest_date = unix_time(yesterday)
|
oldest_date = unix_time(yesterday)
|
||||||
response = conn.list_open_workflow_executions('test-domain',
|
response = conn.list_open_workflow_executions('test-domain',
|
||||||
oldest_date,
|
oldest_date,
|
||||||
@ -159,7 +159,7 @@ def test_list_closed_workflow_executions():
|
|||||||
reason='a more complete reason',
|
reason='a more complete reason',
|
||||||
run_id=run_id)
|
run_id=run_id)
|
||||||
|
|
||||||
yesterday = datetime.now() - timedelta(days=1)
|
yesterday = datetime.utcnow() - timedelta(days=1)
|
||||||
oldest_date = unix_time(yesterday)
|
oldest_date = unix_time(yesterday)
|
||||||
response = conn.list_closed_workflow_executions(
|
response = conn.list_closed_workflow_executions(
|
||||||
'test-domain',
|
'test-domain',
|
||||||
|
Loading…
Reference in New Issue
Block a user