fixed tf-tests: TestAccRoute53Zone, TestAccRoute53ZoneDataSource (#5229)
This commit is contained in:
parent
00f9b47b45
commit
b66e04ffd5
@ -575,10 +575,9 @@ class Route53Backend(BaseBackend):
|
|||||||
this_zone = self.get_hosted_zone(zone.id)
|
this_zone = self.get_hosted_zone(zone.id)
|
||||||
for vpc in this_zone.vpcs:
|
for vpc in this_zone.vpcs:
|
||||||
if vpc["vpc_id"] == vpc_id:
|
if vpc["vpc_id"] == vpc_id:
|
||||||
this_id = f"/hostedzone/{zone.id}"
|
|
||||||
zone_list.append(
|
zone_list.append(
|
||||||
{
|
{
|
||||||
"HostedZoneId": this_id,
|
"HostedZoneId": zone.id,
|
||||||
"Name": zone.name,
|
"Name": zone.name,
|
||||||
"Owner": {"OwningAccount": get_account_id()},
|
"Owner": {"OwningAccount": get_account_id()},
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ class Route53(BaseResponse):
|
|||||||
route53_backend.disassociate_vpc(zoneid, vpcid)
|
route53_backend.disassociate_vpc(zoneid, vpcid)
|
||||||
|
|
||||||
template = Template(DISASSOCIATE_VPC_RESPONSE)
|
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):
|
def rrset_response(self, request, full_url, headers):
|
||||||
self.setup_class(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"?>
|
ASSOCIATE_VPC_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<AssociateVPCWithHostedZoneResponse>
|
<AssociateVPCWithHostedZoneResponse>
|
||||||
<ChangeInfo>
|
<ChangeInfo>
|
||||||
<Comment>{{ comment }}</Comment>
|
<Comment>{{ comment or "" }}</Comment>
|
||||||
<Id>/change/a1b2c3d4</Id>
|
<Id>/change/a1b2c3d4</Id>
|
||||||
<Status>INSYNC</Status>
|
<Status>INSYNC</Status>
|
||||||
<SubmittedAt>2017-03-31T01:36:41.958Z</SubmittedAt>
|
<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"?>
|
DISASSOCIATE_VPC_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<DisassociateVPCFromHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
<DisassociateVPCFromHostedZoneResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
|
||||||
<ChangeInfo>
|
<ChangeInfo>
|
||||||
<Comment>{{ comment }}</Comment>
|
<Comment>{{ comment or "" }}</Comment>
|
||||||
<Id>/change/a1b2c3d4</Id>
|
<Id>/change/a1b2c3d4</Id>
|
||||||
<Status>INSYNC</Status>
|
<Status>INSYNC</Status>
|
||||||
<SubmittedAt>2017-03-31T01:36:41.958Z</SubmittedAt>
|
<SubmittedAt>2017-03-31T01:36:41.958Z</SubmittedAt>
|
||||||
|
@ -174,6 +174,11 @@ route53:
|
|||||||
- TestAccRoute53Zone_VPC_single
|
- TestAccRoute53Zone_VPC_single
|
||||||
- TestAccRoute53Zone_VPC_multiple
|
- TestAccRoute53Zone_VPC_multiple
|
||||||
- TestAccRoute53Zone_VPC_updates
|
- TestAccRoute53Zone_VPC_updates
|
||||||
|
- TestAccRoute53ZoneAssociation
|
||||||
|
- TestAccRoute53ZoneDataSource_id
|
||||||
|
- TestAccRoute53ZoneDataSource_name
|
||||||
|
- TestAccRoute53ZoneDataSource_tags
|
||||||
|
- TestAccRoute53ZoneDataSource_vpc
|
||||||
s3:
|
s3:
|
||||||
- TestAccS3BucketPolicy
|
- TestAccS3BucketPolicy
|
||||||
- TestAccS3BucketPublicAccessBlock
|
- TestAccS3BucketPublicAccessBlock
|
||||||
|
@ -752,13 +752,14 @@ def test_list_hosted_zones_by_vpc():
|
|||||||
HostedZoneConfig=dict(PrivateZone=True, Comment="test com"),
|
HostedZoneConfig=dict(PrivateZone=True, Comment="test com"),
|
||||||
VPC={"VPCRegion": region, "VPCId": vpc_id},
|
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 = conn.list_hosted_zones_by_vpc(VPCId=vpc_id, VPCRegion=region)
|
||||||
response.should.have.key("ResponseMetadata")
|
response.should.have.key("ResponseMetadata")
|
||||||
response.should.have.key("HostedZoneSummaries")
|
response.should.have.key("HostedZoneSummaries")
|
||||||
response["HostedZoneSummaries"].should.have.length_of(1)
|
response["HostedZoneSummaries"].should.have.length_of(1)
|
||||||
response["HostedZoneSummaries"][0].should.have.key("HostedZoneId")
|
response["HostedZoneSummaries"][0].should.have.key("HostedZoneId")
|
||||||
retured_zone = response["HostedZoneSummaries"][0]
|
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"])
|
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"]:
|
for summary in response["HostedZoneSummaries"]:
|
||||||
# use the zone name as the index
|
# use the zone name as the index
|
||||||
index = summary["Name"].split(".")[1]
|
index = summary["Name"].split(".")[1]
|
||||||
|
zone_id = zones[index]["HostedZone"]["Id"].split("/")[2]
|
||||||
summary.should.have.key("HostedZoneId")
|
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.should.have.key("Name")
|
||||||
summary["Name"].should.equal(zones[index]["HostedZone"]["Name"])
|
summary["Name"].should.equal(zones[index]["HostedZone"]["Name"])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user