Fix route53 hosted zone id parsing.

The zone id previously contained hostedzone/<zone_id>
This commit is contained in:
Steve Pulec 2014-09-08 22:00:55 -04:00
parent 22d9141122
commit 79e31e7287
2 changed files with 7 additions and 11 deletions

View File

@ -7,6 +7,6 @@ url_bases = [
url_paths = {
'{0}$': responses.list_or_create_hostzone_response,
'{0}/.+$': responses.get_or_delete_hostzone_response,
'{0}/.+/rrset$': responses.rrset_response,
'{0}/[^/]+$': responses.get_or_delete_hostzone_response,
'{0}/[^/]+/rrset$': responses.rrset_response,
}

View File

@ -1,11 +1,7 @@
from __future__ import unicode_literals
import boto
from boto.exception import S3ResponseError
from boto.s3.key import Key
from boto.route53.record import ResourceRecordSets
from freezegun import freeze_time
import requests
import sure # noqa
@ -19,11 +15,11 @@ def test_hosted_zone():
zones = conn.get_all_hosted_zones()
len(zones["ListHostedZonesResponse"]["HostedZones"]).should.equal(1)
secondzone = conn.create_hosted_zone("testdns1.aws.com")
conn.create_hosted_zone("testdns1.aws.com")
zones = conn.get_all_hosted_zones()
len(zones["ListHostedZonesResponse"]["HostedZones"]).should.equal(2)
id1 = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"]
id1 = firstzone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
zone = conn.get_hosted_zone(id1)
zone["GetHostedZoneResponse"]["HostedZone"]["Name"].should.equal("testdns.aws.com")
@ -38,11 +34,11 @@ def test_hosted_zone():
def test_rrset():
conn = boto.connect_route53('the_key', 'the_secret')
conn.get_all_rrsets.when.called_with("abcd", type="A").\
should.throw(boto.route53.exception.DNSServerError, "404 Not Found")
conn.get_all_rrsets.when.called_with("abcd", type="A").should.throw(
boto.route53.exception.DNSServerError, "404 Not Found")
zone = conn.create_hosted_zone("testdns.aws.com")
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"]
zoneid = zone["CreateHostedZoneResponse"]["HostedZone"]["Id"].split("/")[-1]
changes = ResourceRecordSets(conn, zoneid)
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A")