diff --git a/moto/cloudwatch/responses.py b/moto/cloudwatch/responses.py index 064e6964d..d35560aeb 100644 --- a/moto/cloudwatch/responses.py +++ b/moto/cloudwatch/responses.py @@ -95,52 +95,54 @@ PUT_METRIC_ALARM_TEMPLATE = """ - - {% for alarm in alarms %} - - {{ alarm.actions_enabled }} - - {% for action in alarm.alarm_actions %} - {{ action }} - {% endfor %} - - {{ alarm.arn }} - {{ alarm.configuration_updated_timestamp }} - {{ alarm.description }} - {{ alarm.name }} - {{ alarm.comparison_operator }} - - {% for dimension in alarm.dimensions %} - - {{ dimension.name }} - {{ dimension.value }} - - {% endfor %} - - {{ alarm.evaluation_periods }} - - {% for action in alarm.insufficient_data_actions %} - {{ action }} - {% endfor %} - - {{ alarm.metric_name }} - {{ alarm.namespace }} - - {% for action in alarm.ok_actions %} - {{ action }} - {% endfor %} - - {{ alarm.period }} - {{ alarm.state_reason }} - {{ alarm.state_reason_data }} - {{ alarm.state_updated_timestamp }} - {{ alarm.state_value }} - {{ alarm.statistic }} - {{ alarm.threshold }} - {{ alarm.unit }} - - {% endfor %} - + + + {% for alarm in alarms %} + + {{ alarm.actions_enabled }} + + {% for action in alarm.alarm_actions %} + {{ action }} + {% endfor %} + + {{ alarm.arn }} + {{ alarm.configuration_updated_timestamp }} + {{ alarm.description }} + {{ alarm.name }} + {{ alarm.comparison_operator }} + + {% for dimension in alarm.dimensions %} + + {{ dimension.name }} + {{ dimension.value }} + + {% endfor %} + + {{ alarm.evaluation_periods }} + + {% for action in alarm.insufficient_data_actions %} + {{ action }} + {% endfor %} + + {{ alarm.metric_name }} + {{ alarm.namespace }} + + {% for action in alarm.ok_actions %} + {{ action }} + {% endfor %} + + {{ alarm.period }} + {{ alarm.state_reason }} + {{ alarm.state_reason_data }} + {{ alarm.state_updated_timestamp }} + {{ alarm.state_value }} + {{ alarm.statistic }} + {{ alarm.threshold }} + {{ alarm.unit }} + + {% endfor %} + + """ DELETE_METRIC_ALARMS_TEMPLATE = """ diff --git a/moto/route53/models.py b/moto/route53/models.py index 0e79d617a..047bee1da 100644 --- a/moto/route53/models.py +++ b/moto/route53/models.py @@ -113,7 +113,9 @@ class FakeZone(object): def __init__(self, name, id_, comment=None): self.name = name self.id = id_ - self.comment = comment + if comment is not None: + self.comment = comment + self.private_zone = False self.rrsets = [] def add_rrset(self, record_set): diff --git a/moto/route53/responses.py b/moto/route53/responses.py index 957ddb9c1..edd766b01 100644 --- a/moto/route53/responses.py +++ b/moto/route53/responses.py @@ -9,7 +9,10 @@ def list_or_create_hostzone_response(request, full_url, headers): if request.method == "POST": elements = xmltodict.parse(request.body) - comment = elements["CreateHostedZoneRequest"]["HostedZoneConfig"]["Comment"] + if "HostedZoneConfig" in elements["CreateHostedZoneRequest"]: + comment = elements["CreateHostedZoneRequest"]["HostedZoneConfig"]["Comment"] + else: + comment = None new_zone = route53_backend.create_hosted_zone(elements["CreateHostedZoneRequest"]["Name"], comment=comment) template = Template(CREATE_HOSTED_ZONE_RESPONSE) return 201, headers, template.render(zone=new_zone) @@ -110,6 +113,14 @@ def health_check_response(request, full_url, headers): health_checks = route53_backend.get_health_checks() return 200, headers, template.render(health_checks=health_checks) +def not_implemented_response(request, full_url, headers): + action = '' + if 'tags' in full_url: + action = 'tags' + elif 'trafficpolicyinstances' in full_url: + action = 'policies' + raise NotImplementedError("The action for {0} has not been implemented for route 53".format(action)) + LIST_RRSET_REPONSE = """ @@ -138,7 +149,10 @@ GET_HOSTED_ZONE_RESPONSE = """ diff --git a/moto/route53/urls.py b/moto/route53/urls.py index 69f776ff0..1f0470a04 100644 --- a/moto/route53/urls.py +++ b/moto/route53/urls.py @@ -10,4 +10,5 @@ url_paths = { '{0}hostedzone/[^/]+$': responses.get_or_delete_hostzone_response, '{0}hostedzone/[^/]+/rrset$': responses.rrset_response, '{0}healthcheck': responses.health_check_response, + '{0}tags|trafficpolicyinstances/*': responses.not_implemented_response, }