Merge pull request #84 from vrivellino/master

moto.route53.responses.rrset_response() fix for spulec/moto#83
This commit is contained in:
Steve Pulec 2014-02-06 20:37:10 -05:00
commit ec2de04c20
2 changed files with 16 additions and 1 deletions

View File

@ -45,7 +45,12 @@ def rrset_response(request, full_url, headers):
if method == "POST": if method == "POST":
elements = xmltodict.parse(request.body) elements = xmltodict.parse(request.body)
for key, value in elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes'].items():
change_list = elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes']['Change']
if not isinstance(change_list, list):
change_list = [elements['ChangeResourceRecordSetsRequest']['ChangeBatch']['Changes']['Change']]
for value in change_list:
action = value['Action'] action = value['Action']
rrset = value['ResourceRecordSet'] rrset = value['ResourceRecordSet']

View File

@ -56,6 +56,16 @@ def test_rrset():
rrsets = conn.get_all_rrsets(zoneid, type="CNAME") rrsets = conn.get_all_rrsets(zoneid, type="CNAME")
rrsets.should.have.length_of(0) rrsets.should.have.length_of(0)
changes = ResourceRecordSets(conn, zoneid)
changes.add_change("DELETE", "foo.bar.testdns.aws.com", "A")
change = changes.add_change("CREATE", "foo.bar.testdns.aws.com", "A")
change.add_value("5.6.7.8")
changes.commit()
rrsets = conn.get_all_rrsets(zoneid, type="A")
rrsets.should.have.length_of(1)
rrsets[0].resource_records[0].should.equal('5.6.7.8')
changes = ResourceRecordSets(conn, zoneid) changes = ResourceRecordSets(conn, zoneid)
changes.add_change("DELETE", "foo.bar.testdns.aws.com", "A") changes.add_change("DELETE", "foo.bar.testdns.aws.com", "A")
changes.commit() changes.commit()