Fix Route53 response and tests (#804)

* Fix route53 response \n Fix route53 tests

* Fixing index

* fix zone ID on test_route53_with_update
This commit is contained in:
Akhter Ali 2017-01-18 21:40:04 -05:00 committed by Steve Pulec
parent a967ec0d39
commit 2bf85fe25d
3 changed files with 21 additions and 3 deletions

View File

@ -21,8 +21,15 @@ def list_or_create_hostzone_response(request, full_url, headers):
else:
comment = None
private_zone = False
name = elements["CreateHostedZoneRequest"]["Name"]
if name[-1] != ".":
name += "."
new_zone = route53_backend.create_hosted_zone(
elements["CreateHostedZoneRequest"]["Name"],
name,
comment=comment,
private_zone=private_zone,
)
@ -247,7 +254,7 @@ LIST_HOSTED_ZONES_RESPONSE = """<ListHostedZonesResponse xmlns="https://route53.
<HostedZones>
{% for zone in zones %}
<HostedZone>
<Id>{{ zone.id }}</Id>
<Id>/hostedzone/{{ zone.id }}</Id>
<Name>{{ zone.name }}</Name>
<Config>
{% if zone.comment %}

View File

@ -1170,6 +1170,8 @@ def test_route53_roundrobin():
zones = route53_conn.get_all_hosted_zones()['ListHostedZonesResponse']['HostedZones']
list(zones).should.have.length_of(1)
zone_id = zones[0]['Id']
zone_id = zone_id.split('/')
zone_id = zone_id[2]
rrsets = route53_conn.get_all_rrsets(zone_id)
rrsets.hosted_zone_id.should.equal(zone_id)
@ -1215,6 +1217,9 @@ def test_route53_ec2_instance_with_public_ip():
zones = route53_conn.get_all_hosted_zones()['ListHostedZonesResponse']['HostedZones']
list(zones).should.have.length_of(1)
zone_id = zones[0]['Id']
zone_id = zone_id.split('/')
zone_id = zone_id[2]
rrsets = route53_conn.get_all_rrsets(zone_id)
rrsets.should.have.length_of(1)
@ -1255,6 +1260,8 @@ def test_route53_associate_health_check():
zones = route53_conn.get_all_hosted_zones()['ListHostedZonesResponse']['HostedZones']
list(zones).should.have.length_of(1)
zone_id = zones[0]['Id']
zone_id = zone_id.split('/')
zone_id = zone_id[2]
rrsets = route53_conn.get_all_rrsets(zone_id)
rrsets.should.have.length_of(1)
@ -1278,6 +1285,8 @@ def test_route53_with_update():
zones = route53_conn.get_all_hosted_zones()['ListHostedZonesResponse']['HostedZones']
list(zones).should.have.length_of(1)
zone_id = zones[0]['Id']
zone_id = zone_id.split('/')
zone_id = zone_id[2]
rrsets = route53_conn.get_all_rrsets(zone_id)
rrsets.should.have.length_of(1)
@ -1295,6 +1304,8 @@ def test_route53_with_update():
zones = route53_conn.get_all_hosted_zones()['ListHostedZonesResponse']['HostedZones']
list(zones).should.have.length_of(1)
zone_id = zones[0]['Id']
zone_id = zone_id.split('/')
zone_id = zone_id[2]
rrsets = route53_conn.get_all_rrsets(zone_id)
rrsets.should.have.length_of(1)

View File

@ -25,7 +25,7 @@ def test_hosted_zone():
id1 = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
zone = conn.get_hosted_zone(id1)
zone["GetHostedZoneResponse"]["HostedZone"]["Name"].should.equal("testdns.aws.com")
zone["GetHostedZoneResponse"]["HostedZone"]["Name"].should.equal("testdns.aws.com.")
conn.delete_hosted_zone(id1)
zones = conn.get_all_hosted_zones()