fixed tf-tests: TestAccRoute53Zone, TestAccRoute53ZoneDataSource (#5229)

This commit is contained in:
Macwan Nevil 2022-06-16 01:31:11 +05:30 committed by GitHub
parent 00f9b47b45
commit b66e04ffd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 7 deletions

View File

@ -575,10 +575,9 @@ class Route53Backend(BaseBackend):
this_zone = self.get_hosted_zone(zone.id)
for vpc in this_zone.vpcs:
if vpc["vpc_id"] == vpc_id:
this_id = f"/hostedzone/{zone.id}"
zone_list.append(
{
"HostedZoneId": this_id,
"HostedZoneId": zone.id,
"Name": zone.name,
"Owner": {"OwningAccount": get_account_id()},
}

View File

@ -172,7 +172,7 @@ class Route53(BaseResponse):
route53_backend.disassociate_vpc(zoneid, vpcid)
template = Template(DISASSOCIATE_VPC_RESPONSE)
return 200, headers, template.render(comment)
return 200, headers, template.render(comment=comment)
def rrset_response(self, request, full_url, headers):
self.setup_class(request, full_url, headers)
@ -825,7 +825,7 @@ UPDATE_HOSTED_ZONE_COMMENT_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
ASSOCIATE_VPC_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
<AssociateVPCWithHostedZoneResponse>
<ChangeInfo>
<Comment>{{ comment }}</Comment>
<Comment>{{ comment or "" }}</Comment>
<Id>/change/a1b2c3d4</Id>
<Status>INSYNC</Status>
<SubmittedAt>2017-03-31T01:36:41.958Z</SubmittedAt>
@ -836,7 +836,7 @@ ASSOCIATE_VPC_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
DISASSOCIATE_VPC_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
<DisassociateVPCFromHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<ChangeInfo>
<Comment>{{ comment }}</Comment>
<Comment>{{ comment or "" }}</Comment>
<Id>/change/a1b2c3d4</Id>
<Status>INSYNC</Status>
<SubmittedAt>2017-03-31T01:36:41.958Z</SubmittedAt>

View File

@ -174,6 +174,11 @@ route53:
- TestAccRoute53Zone_VPC_single
- TestAccRoute53Zone_VPC_multiple
- TestAccRoute53Zone_VPC_updates
- TestAccRoute53ZoneAssociation
- TestAccRoute53ZoneDataSource_id
- TestAccRoute53ZoneDataSource_name
- TestAccRoute53ZoneDataSource_tags
- TestAccRoute53ZoneDataSource_vpc
s3:
- TestAccS3BucketPolicy
- TestAccS3BucketPublicAccessBlock

View File

@ -752,13 +752,14 @@ def test_list_hosted_zones_by_vpc():
HostedZoneConfig=dict(PrivateZone=True, Comment="test com"),
VPC={"VPCRegion": region, "VPCId": vpc_id},
)
zone_id = zone_b["HostedZone"]["Id"].split("/")[2]
response = conn.list_hosted_zones_by_vpc(VPCId=vpc_id, VPCRegion=region)
response.should.have.key("ResponseMetadata")
response.should.have.key("HostedZoneSummaries")
response["HostedZoneSummaries"].should.have.length_of(1)
response["HostedZoneSummaries"][0].should.have.key("HostedZoneId")
retured_zone = response["HostedZoneSummaries"][0]
retured_zone["HostedZoneId"].should.equal(zone_b["HostedZone"]["Id"])
retured_zone["HostedZoneId"].should.equal(zone_id)
retured_zone["Name"].should.equal(zone_b["HostedZone"]["Name"])
@ -792,8 +793,9 @@ def test_list_hosted_zones_by_vpc_with_multiple_vpcs():
for summary in response["HostedZoneSummaries"]:
# use the zone name as the index
index = summary["Name"].split(".")[1]
zone_id = zones[index]["HostedZone"]["Id"].split("/")[2]
summary.should.have.key("HostedZoneId")
summary["HostedZoneId"].should.equal(zones[index]["HostedZone"]["Id"])
summary["HostedZoneId"].should.equal(zone_id)
summary.should.have.key("Name")
summary["Name"].should.equal(zones[index]["HostedZone"]["Name"])