added test asserts and review comments
This commit is contained in:
parent
84100c4483
commit
f4888da334
@ -2901,7 +2901,7 @@ class VPCBackend(object):
|
||||
#validates if vpc is present or not.
|
||||
self.get_vpc(vpc_id)
|
||||
|
||||
if type == "interface" or "Interface ":
|
||||
if type and type.lower() == "interface":
|
||||
|
||||
network_interface_ids = []
|
||||
for subnet_id in subnet_ids:
|
||||
@ -2920,6 +2920,8 @@ class VPCBackend(object):
|
||||
route_table_id,
|
||||
service_destination_cidr
|
||||
)
|
||||
if dns_entries:
|
||||
dns_entries = [dns_entries]
|
||||
|
||||
vpc_end_point = VPCEndPoint(
|
||||
vpc_endpoint_id,
|
||||
@ -2930,7 +2932,7 @@ class VPCBackend(object):
|
||||
route_table_ids,
|
||||
subnet_ids,
|
||||
network_interface_ids,
|
||||
[dns_entries],
|
||||
dns_entries,
|
||||
client_token,
|
||||
security_group,
|
||||
tag_specifications,
|
||||
|
@ -439,12 +439,14 @@ CREATE_VPC_END_POINT = """ <CreateVpcEndpointResponse xmlns="http://monitoring.a
|
||||
{% endfor %}
|
||||
</subnetIdSet>
|
||||
<dnsEntrySet>
|
||||
{% if vpc_end_point.dns_entries %}
|
||||
{% for entry in vpc_end_point.dns_entries %}
|
||||
<item>
|
||||
<hostedZoneId>{{ entry["hosted_zone_id"] }}</hostedZoneId>
|
||||
<dnsName>{{ entry["dns_name"] }}</dnsName>
|
||||
</item>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</dnsEntrySet>
|
||||
<creationTimestamp>{{ vpc_end_point.created_at }}</creationTimestamp>
|
||||
</vpcEndpoint>
|
||||
|
@ -630,6 +630,7 @@ def test_create_vpc_end_point():
|
||||
|
||||
route_table = ec2.create_route_table(VpcId=vpc["Vpc"]["VpcId"])
|
||||
|
||||
# test without any end point type specified
|
||||
vpc_end_point = ec2.create_vpc_endpoint(
|
||||
VpcId=vpc["Vpc"]["VpcId"],
|
||||
ServiceName="com.amazonaws.us-east-1.s3",
|
||||
@ -641,7 +642,24 @@ def test_create_vpc_end_point():
|
||||
vpc_end_point["VpcEndpoint"]["RouteTableIds"][0].\
|
||||
should.equal(route_table["RouteTable"]["RouteTableId"])
|
||||
vpc_end_point["VpcEndpoint"]["VpcId"].should.equal(vpc["Vpc"]["VpcId"])
|
||||
vpc_end_point["VpcEndpoint"]["DnsEntries"].should.have.length_of(0)
|
||||
|
||||
# test with any end point type as gateway
|
||||
vpc_end_point = ec2.create_vpc_endpoint(
|
||||
VpcId=vpc["Vpc"]["VpcId"],
|
||||
ServiceName="com.amazonaws.us-east-1.s3",
|
||||
RouteTableIds=[route_table["RouteTable"]["RouteTableId"]],
|
||||
VpcEndpointType="gateway"
|
||||
)
|
||||
|
||||
vpc_end_point["VpcEndpoint"]["ServiceName"]. \
|
||||
should.equal("com.amazonaws.us-east-1.s3")
|
||||
vpc_end_point["VpcEndpoint"]["RouteTableIds"][0]. \
|
||||
should.equal(route_table["RouteTable"]["RouteTableId"])
|
||||
vpc_end_point["VpcEndpoint"]["VpcId"].should.equal(vpc["Vpc"]["VpcId"])
|
||||
vpc_end_point["VpcEndpoint"]["DnsEntries"].should.have.length_of(0)
|
||||
|
||||
# test with end point type as interface
|
||||
vpc_end_point = ec2.create_vpc_endpoint(
|
||||
VpcId=vpc["Vpc"]["VpcId"],
|
||||
ServiceName="com.amazonaws.us-east-1.s3",
|
||||
@ -654,3 +672,4 @@ def test_create_vpc_end_point():
|
||||
vpc_end_point["VpcEndpoint"]["SubnetIds"][0].\
|
||||
should.equal(subnet["Subnet"]["SubnetId"])
|
||||
vpc_end_point["VpcEndpoint"]["VpcId"].should.equal(vpc["Vpc"]["VpcId"])
|
||||
len(vpc_end_point["VpcEndpoint"]["DnsEntries"]).should.be.greater_than(0)
|
Loading…
Reference in New Issue
Block a user