diff --git a/moto/cloudwatch/models.py b/moto/cloudwatch/models.py index 74499f61e..395f4f0ba 100644 --- a/moto/cloudwatch/models.py +++ b/moto/cloudwatch/models.py @@ -10,6 +10,8 @@ from .utils import make_arn_for_dashboard DEFAULT_ACCOUNT_ID = 123456789012 +_EMPTY_LIST = tuple() + class Dimension(object): @@ -146,14 +148,14 @@ class Statistics: return sum(self.values) @property - def min(self): + def minimum(self): if 'Minimum' not in self.stats: return None return min(self.values) @property - def max(self): + def maximum(self): if 'Maximum' not in self.stats: return None @@ -228,7 +230,7 @@ class CloudWatchBackend(BaseBackend): def put_metric_data(self, namespace, metric_data): for metric_member in metric_data: self.metric_data.append(MetricDatum( - namespace, metric_member['MetricName'], float(metric_member['Value']), metric_member['Dimensions.member'], metric_member.get('Timestamp'))) + namespace, metric_member['MetricName'], float(metric_member['Value']), metric_member.get('Dimensions.member', _EMPTY_LIST), metric_member.get('Timestamp'))) def get_metric_statistics(self, namespace, metric_name, start_time, end_time, period, stats): period_delta = timedelta(seconds=period) diff --git a/moto/cloudwatch/responses.py b/moto/cloudwatch/responses.py index ccb53337c..c080d4620 100644 --- a/moto/cloudwatch/responses.py +++ b/moto/cloudwatch/responses.py @@ -276,27 +276,27 @@ GET_METRIC_STATISTICS_TEMPLATE = """